无法重定向到 nginx 上的 https 和服务器静态文件



我无法直接通过HTTP(带有缓存等)和其他所有内容(/,/nothing)将要转移到https的内容直接传递/资源的内容。这是现在的配置。

location /resources/ {
        access_log off;
        autoindex on;
        expires 3d;
        ## No need to bleed constant updates. Send the all shebang in o$
        ## fell swoop.
        tcp_nodelay off;
        ## Set the OS file cache.
        open_file_cache max=3000 inactive=120s;
        open_file_cache_valid 45s;
        open_file_cache_min_uses 2;
        open_file_cache_errors off;
        root /usr/share/nginx/www/resources;
        try_files $uri $uri/;
}
location / {
        rewrite ^(.*)$ https://$http_host$request_uri redirect;
        if ($http_host !~ "^www."){
        rewrite ^(.*)$ https://www.$http_host$request_uri redirect;
        }
}

首先从您的位置/资源/。

定义位置/资源块的方式要求URL请求路径以尾声/
结束
换句话说请求

your-domain/resources 

将行不通,但

your-domain/resources/ 

将起作用。

最新更新