86 lines
2.8 KiB
Plaintext
Raw Normal View History

map $http_x_forwarded_port $nc_port {
default "$http_x_forwarded_port";
'' "$server_port";
}
map $http_x_forwarded_proto $nc_proto {
default "$http_x_forwarded_proto";
'' "$scheme";
}
2018-01-17 20:31:32 +00:00
server {
listen 8888;
root /nextcloud;
2018-01-17 20:31:32 +00:00
fastcgi_buffers 64 4K;
2020-01-27 14:03:29 +01:00
fastcgi_hide_header X-Powered-By;
large_client_header_buffers 4 16k;
2018-10-29 15:11:39 +01:00
add_header Referrer-Policy "no-referrer" always;
2020-01-27 14:03:29 +01:00
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
2023-03-21 21:30:47 +01:00
add_header X-Robots-Tag "noindex, nofollow" always;
add_header X-XSS-Protection "0" always;
2018-01-17 20:31:32 +00:00
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
2021-12-05 21:27:34 +01:00
location ^~ /.well-known {
location = /.well-known/carddav { return 301 $nc_proto://$host/remote.php/dav/; }
location = /.well-known/caldav { return 301 $nc_proto://$host/remote.php/dav/; }
2021-12-05 21:27:34 +01:00
location ^~ /.well-known { return 301 $nc_proto://$host/index.php$uri; }
2021-03-25 19:14:11 +01:00
try_files $uri $uri/ =404;
2018-01-17 20:31:32 +00:00
}
location / {
rewrite ^ /index.php$uri;
}
2021-03-25 19:55:19 +01:00
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) {
return 404;
2018-01-17 20:31:32 +00:00
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
2021-03-25 19:55:19 +01:00
return 404;
2018-01-17 20:31:32 +00:00
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
2021-04-25 18:23:11 +02:00
include /etc/nginx/fastcgi_params;
2018-01-17 20:31:32 +00:00
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/php/run/php-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
fastcgi_read_timeout 1200;
}
location ~ ^\/(?:updater|ocs-provider)(?:$|\/) {
2018-01-17 20:31:32 +00:00
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
2018-01-17 20:31:32 +00:00
try_files $uri /index.php$uri$is_args$args;
2021-03-25 19:55:19 +01:00
expires 6M;
access_log off;
}
location ~ \.woff2?$ {
try_files $uri /index.php$uri$is_args$args;
expires 7d;
2018-01-17 20:31:32 +00:00
access_log off;
}
2020-01-27 14:03:29 +01:00
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
2018-01-17 20:31:32 +00:00
try_files $uri /index.php$uri$is_args$args;
access_log off;
}
}