260614d
    rewrite ^/nextcloud$ /nextcloud/ redirect;
260614d
260614d
    location /nextcloud/ {
260614d
        root /usr/share/;
260614d
260614d
        # Add headers to serve security related headers
260614d
        # Before enabling Strict-Transport-Security headers please read into this topic first.
260614d
        # add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
260614d
        add_header X-Content-Type-Options nosniff;
260614d
        add_header X-Frame-Options "SAMEORIGIN";
260614d
        add_header X-XSS-Protection "1; mode=block";
260614d
        add_header X-Robots-Tag none;
260614d
        add_header X-Download-Options noopen;
260614d
        add_header X-Permitted-Cross-Domain-Policies none;
36c8256
        add_header Referrer-Policy no-referrer always;
260614d
260614d
260614d
        # set max upload size
260614d
        client_max_body_size 10G;
260614d
        fastcgi_buffers 64 4K;
260614d
260614d
        # Disable gzip to avoid the removal of the ETag header
260614d
        gzip off;
260614d
260614d
        # Uncomment if your server is build with the ngx_pagespeed module
260614d
        # This module is currently not supported.
260614d
        #pagespeed off;
260614d
260614d
        index index.php;
260614d
260614d
        error_page 403 /nextcloud/core/templates/403.php;
260614d
        error_page 404 /nextcloud/core/templates/404.php;
260614d
260614d
        location ~ ^/nextcloud/apps-appstore/(.*)$ {
260614d
            alias /var/lib/nextcloud/apps/$1;
260614d
        }
260614d
260614d
        location ~ ^/nextcloud/assets/(.*)$ {
260614d
            alias /var/lib/nextcloud/assets/$1;
260614d
        }
260614d
260614d
        location ~ ^/nextcloud/(build|tests|config|lib|3rdparty|templates|data)/ {
260614d
            deny all;
260614d
        }
260614d
260614d
        location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
260614d
            deny all;
260614d
        }
260614d
260614d
        rewrite ^/nextcloud/remote/(.*) /nextcloud/remote.php last;
260614d
        rewrite ^/nextcloud/core/doc/([^\/]+)(?:$|/) /nextcloud/core/doc/$1/index.html;
260614d
260614d
        try_files $uri $uri/ =404;
260614d
260614d
        location ~ \.php(?:$|/) {
260614d
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
260614d
            include fastcgi_params;
260614d
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
260614d
            fastcgi_param PATH_INFO $fastcgi_path_info;
260614d
        #    fastcgi_param HTTPS on;
260614d
            fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
260614d
            fastcgi_pass php-nextcloud;
260614d
            fastcgi_intercept_errors on;
260614d
        }
260614d
260614d
        # Adding the cache control header for js and css files
260614d
        # Make sure it is BELOW the location ~ \.php(?:$|/) { block
260614d
        location ~* \.(?:css|js)$ {
260614d
            add_header Cache-Control "public, max-age=7200";
260614d
            # Optional: Don't log access to assets
260614d
            access_log off;
260614d
        }
260614d
260614d
        # Optional: Don't log access to other assets
260614d
        location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
260614d
            access_log off;
260614d
        }
260614d
260614d
        }
260614d
260614d
260614d