ubuntu – 在达到nginx状态时绕过localhost上的SSL

我有/ nginx_status的位置,昨晚我安装了SSL证书.

server {
    listen 443;
    ...
    location /nginx_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }
}

当它仍然在端口80上时,这是在进行预证书安装.现在,我已经重定向到将www.domain.tld和domain.tld流量重定向到https,例如

server {
        listen 80;
        server_name domain.tld;
        return 301 https://domain.tld$request_uri;
}

server {
        listen 80;
        server_name www.domain.tld;
        return 301 https://domain.tld$request_uri;
}

我正在使用graphdat-relay来监控nginx统计数据,现在卷曲http://127.0.0.1/nginx_status只获取重定向页面,例如

如何告诉nginx绕过SSL并仅在本地允许/ nginx_status?
最佳答案
为此添加一个仅侦听本地主机的特殊服务器.

server {
    listen 127.0.0.1:80;
    listen [::1]:80;
    ...
    location /nginx_status {
        stub_status on;
        access_log off;
        allow 127.0.0.1;
        deny all;
    }
}

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。