Nginx reverse proxy 未找到Nextcloud版本20、404

Nginx reverse proxy 未找到Nextcloud版本20、404,nginx-reverse-proxy,nextcloud,Nginx Reverse Proxy,Nextcloud,我在这里发帖是因为我不知道该怎么办。 我的配置包括docker compose和nextcloud应用程序以及db。我还有另一个nginx容器作为反向代理。在版本19中,一切运行正常。这个问题出现在我升级了nextcloud应用程序(现在20)的映像之后。 我的问题是我得到了404https://my-domain/nextcloud/ . 经过几个小时的调试,我删除了docker compose,然后再次运行它(没有代理)。 一切都很好。 启动反向代理并将nextcloud应用程序配置为仅使用

我在这里发帖是因为我不知道该怎么办。 我的配置包括docker compose和nextcloud应用程序以及db。我还有另一个nginx容器作为反向代理。在版本19中,一切运行正常。这个问题出现在我升级了nextcloud应用程序(现在20)的映像之后。 我的问题是我得到了404https://my-domain/nextcloud/ . 经过几个小时的调试,我删除了docker compose,然后再次运行它(没有代理)。 一切都很好。 启动反向代理并将nextcloud应用程序配置为仅使用https后,问题又出现了

这是我的Ngnix代理配置,希望有人能发现问题并帮助我:

upstream nextcloud {
  server localhost:81;
}

# server {
#     listen 80;
#     server_name my-domain.com;

#     return 301 https://$host$request_uri;
# }

server {
    listen 443 ssl default_server;
    server_name my-domain.com;

    access_log /var/log/nginx/reverse-access.log;
    error_log /var/log/nginx/reverse-error.log;

    ssl_certificate /etc/letsencrypt/live/my-domain.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/my-domain.com/privkey.pem; # managed by Certbot
    
    add_header Strict-Transport-Security "max-age=15768000; includeSubdomains" always;
    server_tokens off;
    ssl_stapling on;
    ssl_trusted_certificate /etc/letsencrypt/live/my-domain.com/chain.pem;
    ssl_stapling_verify on;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_prefer_server_ciphers on;


    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;

    # Remove X-Powered-By, which is an information leak
    fastcgi_hide_header X-Powered-By;

    location = /.well-known/carddav {
      return 301 $scheme://$host:$server_port/nextcloud/remote.php/dav;
    }
    location = /.well-known/caldav {
      return 301 $scheme://$host:$server_port/nextcloud/remote.php/dav;
    }

    location /.well-known/acme-challenge { }

    location ^~ /nextcloud {
        client_max_body_size 0;
        fastcgi_buffers 64 4K;

        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;

        location /nextcloud {
            rewrite ^ /nextcloud/index.php;
        }

        location ~ ^\/nextcloud\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
            deny all;
        }
        location ~ ^\/nextcloud\/(?:\.|autotest|occ|issue|indie|db_|console) {
            deny all;
        }

        location ~ ^\/nextcloud\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) {
            fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
            set $path_info $fastcgi_path_info;
            try_files $fastcgi_script_name =404;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_param PATH_INFO $path_info;
            fastcgi_param HTTPS on;
            fastcgi_param modHeadersAvailable true;
            fastcgi_param front_controller_active true;
            fastcgi_pass nextcloud;
            fastcgi_intercept_errors on;
            fastcgi_request_buffering off;
        }

        location ~ ^\/nextcloud\/(?:updater|oc[ms]-provider)(?:$|\/) {
            try_files $uri/ =404;
            index index.php;
        }

        location ~ ^\/nextcloud\/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ {
            try_files $uri /nextcloud/index.php$request_uri;
            add_header Cache-Control "public, max-age=15778463";
            access_log off;
        }

        location ~ ^\/nextcloud\/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ {
            try_files $uri /nextcloud/index.php$request_uri;
            access_log off;
        }
    }
}