linux curl+;nginx can';没有保留的请求
我正在尝试向localhost发出状态请求,并在error.log文件中获取错误消息。你知道怎么解决这个问题吗? 或者,它可能只是一条信息性的消息,总是伴随着“无保留”数据包 /tmp/error.loglinux curl+;nginx can';没有保留的请求,curl,nginx,Curl,Nginx,我正在尝试向localhost发出状态请求,并在error.log文件中获取错误消息。你知道怎么解决这个问题吗? 或者,它可能只是一条信息性的消息,总是伴随着“无保留”数据包 /tmp/error.log 2014/07/24 06:03:23 [info] 18038#0: *198319 client 127.0.0.1 closed keepalive connection 2014/07/24 06:04:22 [info] 18038#0: *198398 client 127.0.0
2014/07/24 06:03:23 [info] 18038#0: *198319 client 127.0.0.1 closed keepalive connection
2014/07/24 06:04:22 [info] 18038#0: *198398 client 127.0.0.1 closed keepalive connection
/tmp/access.log
127.0.0.1 - - [24/Jul/2014:06:03:23 +0400] "GET /server-status HTTP/1.1" 200 110 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
127.0.0.1 - - [24/Jul/2014:06:04:22 +0400] "GET /server-status HTTP/1.1" 200 110 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.15.3 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"
/etc/nginx/nginx.conf
error_log /var/log/nginx/error.log warn;
http {
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
include /etc/nginx/sites-enabled/*;
}
/etc/nginx/sites enabled/localhost
server {
listen localhost;
server_name nginx_status.localhost;
access_log /tmp/access.log;
error_log /tmp/error.log info;
location /server-status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
server {
listen localhost;
server_name nginx_status.localhost;
access_log /tmp/access.log;
error_log /tmp/error.log info;
location /server-status {
stub_status on;
keepalive_timeout 0; # Disable HTTP keepalive
allow 127.0.0.1;
deny all;
}
}
这不是一个错误。日志消息中的
[info]
表示此消息具有信息性。如果您不想看到这些消息,请将error\u log
指令中的日志级别设置为不太详细的级别,如notice
、warn
、或error
您可以禁用HTTP keepalive以进行状态连接,前提是访问次数足够少:
/etc/nginx/sites enabled/localhost
server {
listen localhost;
server_name nginx_status.localhost;
access_log /tmp/access.log;
error_log /tmp/error.log info;
location /server-status {
stub_status on;
allow 127.0.0.1;
deny all;
}
}
server {
listen localhost;
server_name nginx_status.localhost;
access_log /tmp/access.log;
error_log /tmp/error.log info;
location /server-status {
stub_status on;
keepalive_timeout 0; # Disable HTTP keepalive
allow 127.0.0.1;
deny all;
}
}
多亏了Dashwuff。所以,您认为它总是会附带“无保留”数据包?HTTP保留数据包是与TCP保留数据包分开的,并且与之无关。谢谢您的回答。我可以在“listen localhost”服务器上禁用HTTP keepalive吗?是的,我找到了,这很有帮助!“keepalive_超时0”。谢谢请记住,禁用HTTP keepalive将大大降低服务器的性能,因为浏览器现在必须为每个请求建立新连接。它写为“closed keepalive connection”。所以,它的意思是,这种联系是“保持活力”。我不想保持连接!