2017-10-11 11:20:48 +02:00
|
|
|
map $http_x_forwarded_proto $client_req_scheme_nc {
|
|
|
|
default $scheme;
|
|
|
|
https https;
|
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
|
|
|
include /etc/nginx/conf.d/listen_ssl.active;
|
2019-02-06 22:48:41 +02:00
|
|
|
include /etc/nginx/conf.d/listen_plain.active;
|
2017-10-11 11:20:48 +02:00
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
charset utf-8;
|
|
|
|
override_charset on;
|
|
|
|
|
|
|
|
ssl_certificate /etc/ssl/mail/cert.pem;
|
|
|
|
ssl_certificate_key /etc/ssl/mail/key.pem;
|
2020-10-21 19:00:53 +02:00
|
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
2017-10-11 11:20:48 +02:00
|
|
|
ssl_prefer_server_ciphers on;
|
2020-10-21 19:00:53 +02:00
|
|
|
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
|
|
|
|
ssl_ecdh_curve X25519:X448:secp384r1:secp256k1;
|
2017-10-11 11:20:48 +02:00
|
|
|
ssl_session_cache shared:SSL:50m;
|
|
|
|
ssl_session_timeout 1d;
|
|
|
|
ssl_session_tickets off;
|
2020-05-05 08:11:03 +02:00
|
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
add_header X-Download-Options "noopen" always;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
|
|
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
|
|
|
add_header X-Robots-Tag "none" always;
|
|
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
|
|
|
|
fastcgi_hide_header X-Powered-By;
|
2017-10-11 11:20:48 +02:00
|
|
|
|
2018-01-04 16:57:43 +02:00
|
|
|
server_name NC_SUBD;
|
2017-10-11 11:20:48 +02:00
|
|
|
|
|
|
|
root /web/nextcloud/;
|
|
|
|
|
|
|
|
location = /robots.txt {
|
|
|
|
allow all;
|
|
|
|
log_not_found off;
|
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location = /.well-known/carddav {
|
|
|
|
return 301 $client_req_scheme_nc://$host/remote.php/dav;
|
|
|
|
}
|
2018-01-27 16:22:16 +02:00
|
|
|
|
2017-10-11 11:20:48 +02:00
|
|
|
location = /.well-known/caldav {
|
|
|
|
return 301 $client_req_scheme_nc://$host/remote.php/dav;
|
|
|
|
}
|
|
|
|
|
2018-01-27 16:22:16 +02:00
|
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
|
|
default_type "text/plain";
|
|
|
|
root /web;
|
2017-10-11 11:20:48 +02:00
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
fastcgi_buffers 64 4K;
|
|
|
|
|
2017-10-11 11:20:48 +02:00
|
|
|
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;
|
2018-02-01 14:29:54 +02:00
|
|
|
set_real_ip_from fc00::/7;
|
2018-01-24 09:38:03 +02:00
|
|
|
set_real_ip_from 10.0.0.0/8;
|
|
|
|
set_real_ip_from 172.16.0.0/12;
|
|
|
|
set_real_ip_from 192.168.0.0/16;
|
2017-10-11 11:20:48 +02:00
|
|
|
real_ip_header X-Forwarded-For;
|
|
|
|
real_ip_recursive on;
|
|
|
|
|
|
|
|
location / {
|
|
|
|
rewrite ^ /index.php$uri;
|
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
|
2017-10-11 11:20:48 +02:00
|
|
|
deny all;
|
|
|
|
}
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
|
2017-10-11 11:20:48 +02:00
|
|
|
deny all;
|
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
|
|
|
|
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
|
|
|
|
set $path_info $fastcgi_path_info;
|
|
|
|
try_files $fastcgi_script_name =404;
|
2017-10-11 11:20:48 +02:00
|
|
|
include fastcgi_params;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
2020-05-05 08:11:03 +02:00
|
|
|
fastcgi_param PATH_INFO $path_info;
|
|
|
|
fastcgi_param HTTPS on;
|
|
|
|
# Avoid sending the security headers twice
|
2017-10-11 11:20:48 +02:00
|
|
|
fastcgi_param modHeadersAvailable true;
|
2020-05-05 08:11:03 +02:00
|
|
|
# Enable pretty urls
|
2017-10-11 11:20:48 +02:00
|
|
|
fastcgi_param front_controller_active true;
|
2018-04-26 13:51:55 +02:00
|
|
|
fastcgi_pass phpfpm:9002;
|
2017-10-11 11:20:48 +02:00
|
|
|
fastcgi_intercept_errors on;
|
|
|
|
fastcgi_request_buffering off;
|
2018-04-26 13:51:55 +02:00
|
|
|
client_max_body_size 0;
|
|
|
|
fastcgi_read_timeout 1200;
|
2017-10-11 11:20:48 +02:00
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
|
2017-10-11 11:20:48 +02:00
|
|
|
try_files $uri/ =404;
|
|
|
|
index index.php;
|
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
|
|
|
|
try_files $uri /index.php$request_uri;
|
2017-10-11 11:20:48 +02:00
|
|
|
add_header Cache-Control "public, max-age=15778463";
|
2020-05-05 08:11:03 +02:00
|
|
|
add_header Referrer-Policy "no-referrer" always;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
|
|
add_header X-Download-Options "noopen" always;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
|
|
add_header X-Permitted-Cross-Domain-Policies "none" always;
|
|
|
|
add_header X-Robots-Tag "none" always;
|
|
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
2017-10-11 11:20:48 +02:00
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
|
2020-05-05 08:11:03 +02:00
|
|
|
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
|
|
|
|
try_files $uri /index.php$request_uri;
|
2017-10-11 11:20:48 +02:00
|
|
|
access_log off;
|
|
|
|
}
|
|
|
|
}
|