Docker nextcloud onlyoffice letsencrypt: различия между версиями
Перейти к навигации
Перейти к поиску
Нет описания правки |
Нет описания правки |
||
| Строка 1: | Строка 1: | ||
== Частное облако на основе бесплатного программного обеспечения == |
== Частное облако на основе бесплатного программного обеспечения == |
||
Установка Docker |
Установка Docker https://docs.docker.com/engine/install/ubuntu/ <syntaxhighlight lang="bash"> |
||
curl -fsSL https://get.docker.com -o get-docker.sh |
|||
sh get-docker.sh |
|||
</syntaxhighlight> |
|||
Создание директории, в которую будет происходить установка<syntaxhighlight lang="bash"> |
|||
mkdir -p /opt/nextcloud/conf.d |
|||
</syntaxhighlight> |
|||
Создание конфигурационного файла nextcloud.conf |
|||
vi /opt/nextcloud/conf.d/nextcloud.conf<syntaxhighlight lang="bash"> |
|||
https://docs.docker.com/engine/install/ubuntu/ |
|||
upstream php-handler { |
|||
server app:9000; |
|||
} |
|||
server { |
|||
listen 80; |
|||
listen 443 ssl http2; |
|||
server_name ${FQDN}; |
|||
# Max allowed upload file in web page |
|||
client_max_body_size 20G; |
|||
if ($server_port !~ 443){ |
|||
rewrite ^(/.*)$ https://$host$1 permanent; |
|||
} |
|||
# SSL and Support TLSv1.3 |
|||
Создание директории, в которую будет происходить установка |
|||
ssl_certificate /etc/letsencrypt/live/${FQDN}/fullchain.pem; |
|||
ssl_certificate_key /etc/letsencrypt/live/${FQDN}/privkey.pem; |
|||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; |
|||
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; |
|||
ssl_prefer_server_ciphers on; |
|||
ssl_session_cache shared:SSL:10m; |
|||
ssl_session_timeout 10m; |
|||
error_page 497 https://$host$request_uri; |
|||
# add header information to fix Nextcloud console warning messages |
|||
add_header X-Content-Type-Options nosniff; |
|||
add_header X-XSS-Protection "1; mode=block"; |
|||
add_header X-Robots-Tag "noindex, nofollow" always; |
|||
add_header X-Download-Options noopen; |
|||
add_header X-Frame-Options "SAMEORIGIN" always; |
|||
add_header X-Permitted-Cross-Domain-Policies none; |
|||
add_header Referrer-Policy no-referrer; |
|||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; |
|||
fastcgi_hide_header X-Powered-By; |
|||
root /var/www/html; |
|||
Создание конфигурационного файла nextcloud.conf |
|||
location = /robots.txt { |
|||
allow all; |
|||
log_not_found off; |
|||
access_log off; |
|||
} |
|||
location = /.well-known/carddav { |
|||
return 301 $scheme://$host/remote.php/dav; |
|||
} |
|||
location = /.well-known/caldav { |
|||
return 301 $scheme://$host/remote.php/dav; |
|||
} |
|||
# Enable gzip compression |
|||
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/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; |
|||
# redirection and disable to access backend sensitive folders and resources |
|||
location / { |
|||
rewrite ^ /index.php$request_uri; |
|||
} |
|||
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { |
|||
deny all; |
|||
} |
|||
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) { |
|||
deny all; |
|||
} |
|||
# PHP configuration |
|||
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+)\.php(?:$|\/) { |
|||
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; |
|||
include fastcgi_params; |
|||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
|||
fastcgi_param PATH_INFO $fastcgi_path_info; |
|||
fastcgi_param HTTPS on; |
|||
#Avoid sending the security headers twice |
|||
fastcgi_param modHeadersAvailable true; |
|||
fastcgi_param front_controller_active true; |
|||
fastcgi_pass php-handler; |
|||
fastcgi_intercept_errors on; |
|||
fastcgi_request_buffering off; |
|||
} |
|||
location ~ ^\/(?:updater|ocs-provider)(?:$|\/) { |
|||
try_files $uri/ =404; |
|||
index index.php; |
|||
} |
|||
location ~ \.(?:css|js|woff2?|svg|gif)$ { |
|||
try_files $uri /index.php$request_uri; |
|||
add_header Cache-Control "public, max-age=15778463"; |
|||
add_header X-Content-Type-Options nosniff; |
|||
add_header X-XSS-Protection "1; mode=block"; |
|||
add_header X-Robots-Tag "noindex, nofollow" always; |
|||
add_header X-Download-Options noopen; |
|||
add_header X-Permitted-Cross-Domain-Policies none; |
|||
add_header Referrer-Policy no-referrer; |
|||
access_log off; |
|||
} |
|||
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ { |
|||
try_files $uri /index.php$request_uri; |
|||
# Optional: Don't log access to other assets |
|||
access_log off; |
|||
} |
|||
} |
|||
</syntaxhighlight> |
|||
Создание файла docker-compose.yml |
Создание файла docker-compose.yml |
||
Версия от 14:55, 21 января 2024
Частное облако на основе бесплатного программного обеспечения
Установка Docker https://docs.docker.com/engine/install/ubuntu/
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
Создание директории, в которую будет происходить установка
mkdir -p /opt/nextcloud/conf.d
Создание конфигурационного файла nextcloud.conf
vi /opt/nextcloud/conf.d/nextcloud.conf
upstream php-handler {
server app:9000;
}
server {
listen 80;
listen 443 ssl http2;
server_name ${FQDN};
# Max allowed upload file in web page
client_max_body_size 20G;
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
# SSL and Support TLSv1.3
ssl_certificate /etc/letsencrypt/live/${FQDN}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${FQDN}/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;
# add header information to fix Nextcloud console warning messages
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-Download-Options noopen;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
fastcgi_hide_header X-Powered-By;
root /var/www/html;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
# Enable gzip compression
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/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# redirection and disable to access backend sensitive folders and resources
location / {
rewrite ^ /index.php$request_uri;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
# PHP configuration
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|ocs-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|woff2?|svg|gif)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
Создание файла docker-compose.yml
Запуск контейнеров при помощи docker compose
Проверка доступности nextcloud