Различия
Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
| application:nextcloud [2025/02/21 01:37] – создано mirocow | application:nextcloud [2025/11/28 07:56] (текущий) – 78.138.161.134 | ||
|---|---|---|---|
| Строка 1: | Строка 1: | ||
| + | {{tag> | ||
| + | |||
| ====== Nextcloud ====== | ====== Nextcloud ====== | ||
| + | |||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | * / | ||
| + | |||
| + | ====== Сборка ====== | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | |||
| + | export PROD_V=9.04 | ||
| + | |||
| + | ################################################################################## | ||
| + | |||
| + | cd /opt | ||
| + | git clone https:// | ||
| + | cd / | ||
| + | |||
| + | docker build . -t onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker push ghcr.io/ | ||
| + | docker push thomisus/ | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | docker tag onlyoffice-documentserver-unlimited: | ||
| + | echo "all done" && \ | ||
| + | docker push ghcr.io/ | ||
| + | docker push thomisus/ | ||
| + | </ | ||
| + | |||
| + | ====== Установка ====== | ||
| + | |||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | ===== Установка Onlyoffice + Drawio + Drawio Export ===== | ||
| + | |||
| + | nano docker_compose.yml | ||
| + | <code yaml> | ||
| + | version: ' | ||
| + | |||
| + | services: | ||
| + | |||
| + | # http:// | ||
| + | nginx: | ||
| + | container_name: | ||
| + | image: nginx: | ||
| + | restart: always | ||
| + | networks: | ||
| + | localnetwork: | ||
| + | ipv4_address: | ||
| + | nextcloud_network: | ||
| + | depends_on: | ||
| + | - app | ||
| + | - drawio | ||
| + | - onlyoffice | ||
| + | ports: | ||
| + | - 192.168.1.6: | ||
| + | # - 192.168.1.6: | ||
| + | volumes: | ||
| + | - / | ||
| + | - proxy:/ | ||
| + | - nextcloud:/ | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | |||
| + | # docker exec -u www-data nextcloud-app php occ config: | ||
| + | # docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | # docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | # docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | # docker exec -u www-data nextcloud-app php occ upgrade | ||
| + | app: | ||
| + | image: nextcloud: | ||
| + | container_name: | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | expose: | ||
| + | - ' | ||
| + | - ' | ||
| + | depends_on: | ||
| + | - db | ||
| + | - redis | ||
| + | - cron | ||
| + | - es01 | ||
| + | volumes: | ||
| + | - / | ||
| + | - nextcloud:/ | ||
| + | - crontabs:/ | ||
| + | environment: | ||
| + | - TZ=Europe/ | ||
| + | - MYSQL_HOST=db | ||
| + | - REDIS_HOST=redis | ||
| + | - SKIP_DOMAIN_VALIDATION=true | ||
| + | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 10G | ||
| + | healthcheck: | ||
| + | test: [" | ||
| + | interval: 10s | ||
| + | timeout: 5s | ||
| + | retries: 3 | ||
| + | start_period: | ||
| + | |||
| + | cron: | ||
| + | image: rcdailey/ | ||
| + | restart: unless-stopped | ||
| + | network_mode: | ||
| + | volumes: | ||
| + | - / | ||
| + | - / | ||
| + | - crontabs:/ | ||
| + | environment: | ||
| + | - NEXTCLOUD_CONTAINER_NAME=nextcloud-app | ||
| + | - NEXTCLOUD_PROJECT_NAME= | ||
| + | - NEXTCLOUD_CRON_MINUTE_INTERVAL=5 | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | |||
| + | # http:// | ||
| + | drawio: | ||
| + | image: jgraph/ | ||
| + | container_name: | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | expose: | ||
| + | - ' | ||
| + | environment: | ||
| + | - DRAWIO_SELF_CONTAINED=1 | ||
| + | - EXPORT_URL=http:// | ||
| + | - PLANTUML_URL=http:// | ||
| + | # - PLANTUML_URL=http:// | ||
| + | # - DRAWIO_BASE_URL=${DRAWIO_BASE_URL} | ||
| + | restart: unless-stopped | ||
| + | healthcheck: | ||
| + | test: [" | ||
| + | interval: 1m30s | ||
| + | timeout: 10s | ||
| + | retries: 5 | ||
| + | start_period: | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | |||
| + | # http:// | ||
| + | image-export: | ||
| + | image: jgraph/ | ||
| + | container_name: | ||
| + | expose: | ||
| + | - " | ||
| + | depends_on: | ||
| + | - drawio | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | # environment: | ||
| + | # - DRAWIO_SERVER_URL=${DRAWIO_BASE_URL} | ||
| + | #volumes: | ||
| + | #- ./ | ||
| + | restart: unless-stopped | ||
| + | # deploy: | ||
| + | # | ||
| + | # | ||
| + | # cpus: ' | ||
| + | # | ||
| + | |||
| + | plantuml-server: | ||
| + | image: plantuml/ | ||
| + | expose: | ||
| + | - " | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | depends_on: | ||
| + | - drawio | ||
| + | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | |||
| + | # ONLYOFFICE Docs address: /ds-vpath/ | ||
| + | # ONLYOFFICE Docs address for internal requests from the server: / | ||
| + | # This build of onlyoffice community edition ( documentserver ) has connections limits increased to 9999 ( instead of default 20 ) | ||
| + | onlyoffice: | ||
| + | container_name: | ||
| + | # image: onlyoffice/ | ||
| + | image: thomisus/ | ||
| + | stdin_open: true | ||
| + | tty: true | ||
| + | environment: | ||
| + | - JWT_SECRET=secret | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | restart: unless-stopped | ||
| + | expose: | ||
| + | - ' | ||
| + | volumes: | ||
| + | - document_data:/ | ||
| + | - document_log:/ | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | |||
| + | db: | ||
| + | image: mariadb: | ||
| + | container_name: | ||
| + | command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | volumes: | ||
| + | - / | ||
| + | - db:/ | ||
| + | environment: | ||
| + | - TZ=Europe/ | ||
| + | - MYSQL_ROOT_PASSWORD=toor | ||
| + | - MYSQL_PASSWORD=mysql | ||
| + | - MYSQL_DATABASE=nextcloud | ||
| + | - MYSQL_USER=nextcloud | ||
| + | ports: | ||
| + | - 13306:3306 | ||
| + | restart: unless-stopped | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 8G | ||
| + | |||
| + | redis: | ||
| + | image: redis: | ||
| + | restart: unless-stopped | ||
| + | volumes: | ||
| + | - redis01:/ | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 2G | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | |||
| + | es01: | ||
| + | image: elasticsearch: | ||
| + | container_name: | ||
| + | restart: always | ||
| + | environment: | ||
| + | node.name: elasticsearch | ||
| + | bootstrap.memory_lock: | ||
| + | ES_JAVA_OPTS: | ||
| + | xpack.security.enabled: | ||
| + | # Bootstrap password. | ||
| + | # Used to initialize the keystore during the initial startup of | ||
| + | # Elasticsearch. Ignored on subsequent runs. | ||
| + | # ELASTIC_PASSWORD: | ||
| + | # Use single node discovery in order to disable production mode and avoid bootstrap checks. | ||
| + | # see: https:// | ||
| + | discovery.type: | ||
| + | ulimits: | ||
| + | memlock: | ||
| + | soft: -1 | ||
| + | hard: -1 | ||
| + | volumes: | ||
| + | - data01:/ | ||
| + | expose: | ||
| + | - 9200 | ||
| + | - 9300 | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | deploy: | ||
| + | resources: | ||
| + | limits: | ||
| + | cpus: ' | ||
| + | memory: 4G | ||
| + | | ||
| + | volumes: | ||
| + | proxy: | ||
| + | nextcloud: | ||
| + | crontabs: | ||
| + | db: | ||
| + | document_data: | ||
| + | document_log: | ||
| + | data01: | ||
| + | redis01: | ||
| + | screenshoter: | ||
| + | | ||
| + | networks: | ||
| + | nextcloud_network: | ||
| + | localnetwork: | ||
| + | name: localnetwork | ||
| + | driver: ipvlan | ||
| + | driver_opts: | ||
| + | parent: eno1 | ||
| + | ipvlan_mode: | ||
| + | ipam: | ||
| + | config: | ||
| + | - subnet: " | ||
| + | ip_range: " | ||
| + | gateway: " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Настройка прокси-сервера ===== | ||
| nano / | nano / | ||
| Строка 19: | Строка 336: | ||
| log_format | log_format | ||
| - | | + | |
| - | '" | + | '" |
| access_log | access_log | ||
| Строка 50: | Строка 367: | ||
| server_tokens off; | server_tokens off; | ||
| - | # Add headers | + | # HSTS settings |
| - | add_header Strict-Transport-Security " | + | # WARNING: Only add the preload option once you read about |
| - | add_header X-Content-Type-Options nosniff; | + | # the consequences in https:// |
| - | add_header X-XSS-Protection "1; mode=block"; | + | # will add the domain |
| - | add_header X-Robots-Tag none; | + | |
| - | add_header X-Download-Options noopen; | + | # could take several months. |
| - | add_header X-Permitted-Cross-Domain-Policies none; | + | #add_header Strict-Transport-Security " |
| - | | + | # set max upload size and increase upload timeout: |
| - | client_max_body_size 10G; # 0=unlimited - set max upload size | + | client_max_body_size 512M; |
| + | client_body_timeout 300s; | ||
| fastcgi_buffers 64 4K; | fastcgi_buffers 64 4K; | ||
| - | gzip off; | + | |
| + | gzip on; | ||
| + | gzip_vary on; | ||
| + | gzip_comp_level 4; | ||
| + | gzip_min_length 256; | ||
| + | gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; | ||
| + | gzip_types application/ | ||
| + | |||
| + | # Pagespeed is not supported by Nextcloud, so if your server is built | ||
| + | # with the `ngx_pagespeed` module, uncomment this line to disable it. | ||
| + | # | ||
| + | |||
| + | # The settings allows you to optimize the HTTP2 bandwidth. | ||
| + | # See https:// | ||
| + | # for tuning hints | ||
| + | client_body_buffer_size 512k; | ||
| + | |||
| + | # HTTP response headers borrowed from Nextcloud `.htaccess` | ||
| + | add_header Referrer-Policy | ||
| + | add_header X-Content-Type-Options | ||
| + | add_header X-Frame-Options | ||
| + | add_header X-Permitted-Cross-Domain-Policies | ||
| + | add_header X-Robots-Tag | ||
| + | add_header X-XSS-Protection | ||
| + | |||
| + | # Remove X-Powered-By, | ||
| + | fastcgi_hide_header X-Powered-By; | ||
| + | |||
| + | # Set .mjs and .wasm MIME types | ||
| + | # Either include it in the default mime.types list | ||
| + | # and include that list explicitly or add the file extension | ||
| + | # only for Nextcloud like below: | ||
| + | include mime.types; | ||
| + | types { | ||
| + | text/ | ||
| + | application/ | ||
| + | } | ||
| + | |||
| + | # Specify how to handle directories -- specifying `/ | ||
| + | # here as the fallback means that Nginx always exhibits the desired behaviour | ||
| + | # when a client requests a path that corresponds to a directory that exists | ||
| + | # on the server. In particular, if that directory contains an index.php file, | ||
| + | # that file is correctly served; if it doesn' | ||
| + | # the front-end controller. This consistent behaviour means that we don't need | ||
| + | # to specify custom rules for certain paths (e.g. images and other assets, | ||
| + | # `/updater`, `/ | ||
| + | # `try_files $uri $uri/ / | ||
| + | # always provides the desired behaviour. | ||
| + | index index.php index.html / | ||
| + | |||
| + | # Rule borrowed from `.htaccess` to handle Microsoft DAV clients | ||
| + | #location = / { | ||
| + | # if ( $http_user_agent ~ ^DavClnt ) { | ||
| + | # return 302 / | ||
| + | # } | ||
| + | #} | ||
| + | |||
| + | location = /robots.txt { | ||
| + | allow all; | ||
| + | log_not_found off; | ||
| + | access_log off; | ||
| + | } | ||
| + | |||
| + | # Make a regex exception for `/ | ||
| + | # access it despite the existence of the regex rule | ||
| + | # `location ~ / | ||
| + | # for `/ | ||
| + | location ^~ / | ||
| + | # The rules in this block are an adaptation of the rules | ||
| + | # in `.htaccess` that concern `/ | ||
| + | |||
| + | location = / | ||
| + | location = / | ||
| + | |||
| + | location / | ||
| + | location / | ||
| + | |||
| + | # Let Nextcloud' | ||
| + | # requests by passing them to the front-end controller. | ||
| + | return 301 / | ||
| + | } | ||
| + | |||
| + | # Rules borrowed from `.htaccess` to hide certain paths from clients | ||
| + | location ~ ^/ | ||
| + | location ~ ^/ | ||
| index index.php; | index index.php; | ||
| Строка 76: | Строка 478: | ||
| proxy_set_header X-Real-IP $remote_addr; | proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| - | proxy_set_header X-Forwarded-Host $the_host/ds-vpath; | + | proxy_set_header X-Forwarded-Host $the_host; |
| proxy_set_header X-Forwarded-Proto $the_scheme; | proxy_set_header X-Forwarded-Proto $the_scheme; | ||
| + | # Correct handling of fallbacks for HTTP headers | ||
| + | proxy_hide_header X-Permitted-Cross-Domain-Policies; | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| } | } | ||
| Строка 93: | Строка 501: | ||
| proxy_set_header X-Forwarded-Host $the_host/ | proxy_set_header X-Forwarded-Host $the_host/ | ||
| proxy_set_header X-Forwarded-Proto $the_scheme; | proxy_set_header X-Forwarded-Proto $the_scheme; | ||
| + | # Correct handling of fallbacks for HTTP headers | ||
| + | proxy_hide_header X-Permitted-Cross-Domain-Policies; | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| + | proxy_hide_header | ||
| } | } | ||
| Строка 101: | Строка 515: | ||
| client_max_body_size 100m; | client_max_body_size 100m; | ||
| proxy_http_version 1.1; | proxy_http_version 1.1; | ||
| - | proxy_set_header Upgrade $http_upgrade; | + | |
| - | proxy_set_header Connection " | + | |
| - | proxy_set_header Host $http_host; | + | |
| - | proxy_set_header X-Real-IP $remote_addr; | + | |
| - | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | + | |
| - | proxy_set_header X-Forwarded-Host $the_host/ | + | |
| - | proxy_set_header X-Forwarded-Proto $the_scheme; | + | |
| + | } | ||
| + | |||
| + | location /service/0 { | ||
| + | rewrite / | ||
| + | proxy_pass http:// | ||
| + | proxy_redirect | ||
| + | client_max_body_size 100m; | ||
| + | proxy_http_version 1.1; | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | #proxy_set_header X-Forwarded-Proto $the_scheme; | ||
| } | } | ||
| Строка 113: | Строка 542: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ===== Продолжение настройки ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app rm / | ||
| + | </ | ||
| + | |||
| + | ===== Установка контейнера и настройка приложения ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker compose up -d | ||
| + | $ docker exec -u www-data nextcloud-app php occ config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ app:install onlyoffice | ||
| + | $ docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ --no-warnings config: | ||
| + | </ | ||
| + | |||
| + | * trusted_domains 1 - Индекс в массиве trusted_domains | ||
| + | |||
| + | |||
| + | ===== Fulltextsearch + Elasticsearch ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app curl -XGET ' | ||
| + | $ docker exec -u www-data nextcloud-app php occ fulltextsearch: | ||
| + | $ docker exec -u www-data nextcloud-app php occ full:index | ||
| + | </ | ||
| + | |||
| + | ===== OCC ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app php occ config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ config: | ||
| + | $ docker exec -u www-data nextcloud-app php occ upgrade | ||
| + | $ docker exec nextcloud-app php -r " | ||
| + | $ docker exec nextcloud-app php composer-setup.php | ||
| + | $ docker exec nextcloud-app mv / | ||
| + | $ docker exec nextcloud-app chmod +x / | ||
| + | </ | ||
| + | |||
| + | ===== Maintenance ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app php occ maintenance: | ||
| + | $ docker exec -u www-data nextcloud-app php occ maintenance: | ||
| + | </ | ||
| + | |||
| + | ===== Logfile ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== Composer ===== | ||
| + | |||
| + | ==== Install ==== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app php -r " | ||
| + | docker exec nextcloud-app php composer-setup.php && \ | ||
| + | docker exec nextcloud-app mv composer.phar / | ||
| + | docker exec nextcloud-app composer -v | ||
| + | </ | ||
| + | |||
| + | ==== Использование ==== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== User Data ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== Custom Application ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app chown www-data: | ||
| + | $ docker exec -u www-data nextcloud-app bash -c 'cd / | ||
| + | </ | ||
| + | |||
| + | ===== Debug ===== | ||
| + | |||
| + | <code bash> | ||
| + | $ docker exec nextcloud-app pecl install xdebug && \ | ||
| + | docker exec nextcloud-app docker-php-ext-enable xdebug && \ | ||
| + | docker exec nextcloud-app rm -rf /tmp/pear && \ | ||
| + | docker exec nextcloud-app bash -c 'echo " | ||
| + | xdebug.start_with_request=yes | ||
| + | xdebug.client_host=host.docker.internal | ||
| + | ;# 9003 is now the default (set this for old PhpStorm settings). | ||
| + | xdebug.client_port=9000" | ||
| + | php -i|grep xdebug | ||
| + | </ | ||
| + | |||
| + | |||