使用 Nginx 作为反向代理的 Docker 上的 Nextcloud

使用 Nginx 作为反向代理的 Docker 上的 Nextcloud

我正在尝试使用 nginx 访问子路径 /nextcloud 下的 nextcloud。

我的配置如下:

   server {
        listen 443 default ssl http2 default_server;
        listen [::]:443 ssl http2 default_server;

        root /config/www;
        index index.html index.htm index.php;
        server_name _;

        ssl off;
        # enable subfolder method reverse proxy confs
        include /config/nginx/proxy-confs/*.subfolder.conf;
        # all ssl related config moved to ssl.conf
        include /config/nginx/ssl.conf;
        # enable for ldap auth
        #include /config/nginx/ldap.conf;
        client_max_body_size 0;

        location / {
                try_files $uri $uri/ /index.html /index.php?$args =404;
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                include /etc/nginx/fastcgi_params;
        }

        # Redirects for DAV clients
        location = /.well-known/carddav {
            return 301 $scheme://$host/nextcloud/remote.php/dav;
        }

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

        location /nextcloud {
            return 301 $scheme://$host/nextcloud/;
        }

        location ^~ /nextcloud/ {
            include /config/nginx/proxy.conf;
            resolver 127.0.0.11 valid=30s;
            set $upstream_nextcloud nextcloud;
            rewrite /nextcloud(.*) $1 break;
            proxy_pass http://$upstream_nextcloud:80;

            proxy_max_temp_file_size 2048m;

            proxy_set_header Range $http_range;
            proxy_set_header If-Range $http_if_range;
            proxy_set_header Connection $http_connection;
            proxy_redirect off;
            proxy_ssl_session_reuse off;
        }
}

当我使用浏览器时一切似乎都很好,但当我使用 nextcloud 客户端并尝试连接时,我收到“纯 HTTP 请求已发送到 HTTPS 端口”的消息。我该怎么办?

相关内容