检查 nginx_status 时出现 301 错误

检查 nginx_status 时出现 301 错误

Zabbix 在尝试获取 nginx_status 时显示 301 错误。

这就是我的zabbix.conf好像:

server {

listen [::]:80;
server_name 127.0.0.1;
location /nginx_status {
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
    access_log off;
    error_log  /var/log/nginx/nginx_status_error.log;
}

location ~ ^/(status|ping)$ {
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:7777;
    fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
    allow 127.0.0.1;
    deny all;
    }

}

当我尝试卷曲时出现此错误:

$ curl 127.0.0.1:80/status
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

中没有消息/var/log/nginx/nginx_status_error.log

我不确定为什么会发生这种情况以及在哪里找到根本原因。我应该做什么或检查以消除此错误?

编辑:

$ curl -i 127.0.0.1:80/status
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Mon, 21 Oct 2019 11:01:17 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://127.0.0.1/status

<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

解决方案:

我评论listen [::]:80;并将端口添加到server_name 127.0.0.1:80;.现在我得到:

$ curl -i 127.0.0.1:80/status
HTTP/1.1 200 OK

相关内容