server { listen 8888; listen [::]:8888; root /nextcloud; # Emit relative redirects (protocol handled by reverse proxy) absolute_redirect off; fastcgi_buffers 64 4K; fastcgi_hide_header X-Powered-By; large_client_header_buffers 4 16k; client_body_timeout 300s; add_header Referrer-Policy "no-referrer" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Permitted-Cross-Domain-Policies "none" always; add_header X-Robots-Tag "noindex, nofollow" always; location = /robots.txt { allow all; log_not_found off; access_log off; } location ^~ /.well-known { location = /.well-known/carddav { return 301 /remote.php/dav/; } location = /.well-known/caldav { return 301 /remote.php/dav/; } return 301 /index.php$request_uri; } location / { rewrite ^ /index.php$request_uri; } location /remote { return 301 /remote.php$request_uri; } location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy)\.php(?:$|\/) { include /etc/nginx/fastcgi_params; 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)(?:$|/) { try_files $uri/ =404; index index.php; } location ~ \.(?:css|js|mjs|svg|gif|ico|jpg|jpeg|png|webp|wasm|tflite|map|ogg|flac|mp4|webm)$ { try_files $uri /index.php$request_uri; expires 6M; access_log off; } location ~ \.(otf|woff2?)$ { try_files $uri /index.php$request_uri; expires 7d; access_log off; } }