Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - #
 - # https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html
 - #
 - # https://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream
 - upstream php-handler {
 - # https://nginx.org/en/docs/http/ngx_http_upstream_module.html#server
 - server 127.0.0.1:9000;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_map_module.html#map
 - map $arg_v $asset_immutable {
 - "" "";
 - default ", immutable";
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#server
 - server {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
 - listen 8082 default_server;
 - listen [::]:8082 default_server;
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#server_name
 - server_name nextcloud.foo.tld;
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#root
 - root /var/www/html;
 - # https://nginx.org/en/docs/ngx_core_module.html#include
 - include /etc/nginx/conf.d/common.conf;
 - # https://nginx.org/en/docs/ngx_core_module.html#include
 - include mime.types;
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#types
 - types {
 - text/javascript js mjs;
 - application/wasm wasm;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_index_module.html
 - index index.php index.html /index.php$request_uri;
 - ########## START nextcloud ##########
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location = / {
 - if ( $http_user_agent ~ ^DavClnt ) {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 302 /remote.php/webdav/$is_args$args;
 - }
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location = /robots.txt {
 - # https://nginx.org/en/docs/http/ngx_http_access_module.html#allow
 - allow all;
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#log_not_found
 - log_not_found off;
 - # https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
 - access_log off;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ^~ /.well-known {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location = /.well-known/carddav {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 301 /remote.php/dav/;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location = /.well-known/caldav {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 301 /remote.php/dav/;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location /.well-known/acme-challenge {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $uri $uri/ =404;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location /.well-known/pki-validation {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $uri $uri/ =404;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 301 /index.php$request_uri;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 404;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 404;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ~ \.php(?:$|/) {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite
 - rewrite ^/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|ocs-provider\/.+|.+\/richdocumentscode(_arm64)?\/proxy) /index.php$request_uri;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info
 - fastcgi_split_path_info ^(.+?\.php)(/.*)$;
 - # https://nginx.org/en/docs/stream/ngx_stream_set_module.html#set
 - set $path_info $fastcgi_path_info;
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $fastcgi_script_name =404;
 - # https://nginx.org/en/docs/ngx_core_module.html#include
 - include fastcgi_params;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param
 - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 - fastcgi_param PATH_INFO $path_info;
 - fastcgi_param modHeadersAvailable true;
 - fastcgi_param front_controller_active true;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_pass
 - fastcgi_pass php-handler;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_intercept_errors
 - fastcgi_intercept_errors on;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_request_buffering
 - fastcgi_request_buffering off;
 - # https://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_max_temp_file_size
 - fastcgi_max_temp_file_size 0;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ~ \.(?:css|js|mjs|svg|gif|png|jpg|ico|wasm|tflite|map|ogg|flac)$ {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $uri /index.php$request_uri;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
 - add_header Cache-Control "public, max-age=15778463$asset_immutable";
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
 - add_header X-Frame-Options "SAMEORIGIN" always;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection
 - add_header X-XSS-Protection "1; mode=block" always;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options
 - add_header X-Content-Type-Options "nosniff" always;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
 - add_header Referrer-Policy "no-referrer" always;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
 - add_header X-Permitted-Cross-Domain-Policies "none" always;
 - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
 - add_header X-Robots-Tag "noindex, nofollow" always;
 - # https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
 - access_log off;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location ~ \.woff2?$ {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $uri /index.php$request_uri;
 - # https://nginx.org/en/docs/http/ngx_http_headers_module.html#expires
 - expires 7d;
 - # https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
 - access_log off;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location /remote {
 - # https://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return
 - return 301 /remote.php$request_uri;
 - }
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#location
 - location / {
 - # https://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
 - try_files $uri $uri/ /index.php$request_uri;
 - }
 - ########## END nextcloud ##########
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment