nginx重写规则不起作用

时间:2018-03-13 13:37:37

标签: nginx url-rewriting

我想将所有流量重定向到HTTPS,但有两个位置用于域验证。

这是我的配置:

server {
    server_name xxxx.de www.xxxx.de;

    # SSLMate domain validation
    location /.well-known/pki-validation/ {
            proxy_pass https://xxxx.http-approval.sslmate.com$request_uri;
            proxy_set_header X-Forwarded-Host $http_host;
            resolver 8.8.8.8;
    }
    location /.well-known/acme-challenge/ {
            proxy_pass https://xxxx.http-approval.sslmate.com$request_uri;
            proxy_set_header X-Forwarded-Host $http_host;
            resolver 8.8.8.8;
    }

    # Redirect everything else to HTTPS
    location / {
            rewrite ^ https://xxxx.de/index.htm permanent;
    }
 }

不幸的是," /"的规则选择了所有内容。地点。我究竟做错了什么?

0 个答案:

没有答案