我收到了很多499 nginx错误代码.我看到这是客户端问题.这不是Nginx或我的uWSGI堆栈的问题.我注意到当获得499时uWSGI日志中的相关性.
address space usage: 383692800 bytes/365MB} {rss usage: 167038976
bytes/159MB} [pid: 16614|app: 0|req: 74184/222373] 74.125.191.16 ()
{36 vars in 481 bytes} [Fri Oct 19 10:07:07 2012] POST /bidder/ =>
generated 0 bytes in 8 msecs (HTTP/1.1 200) 1 headers in 59 bytes (1
switches on core 1760)
SIGPIPE: writing to a closed pipe/socket/fd (probably the client
disconnected) on request /bidder/ (ip 74.125.xxx.xxx) !!!
Fri Oct 19 10:07:07 2012 - write(): Broken pipe [proto/uwsgi.c line
143] during POST /bidder/ (74.125.xxx.xxx) …
Run Code Online (Sandbox Code Playgroud) 我们使用Nginx作为此设置的反向代理:
upstream frontends {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
[...]
}
server {
location / {
proxy_pass http://frontends;
[...]
}
[...]
}
Run Code Online (Sandbox Code Playgroud)
作为访问日志的一部分,我想记录为请求提供服务的上游服务器,在我们的例子中,这意味着关联的localhost端口.
文档中的变量(http://wiki.nginx.org/HttpProxyModule#Variables)提到$ proxy_host和$ proxy_port,但在日志中它们总是以"frontends"和"80"的值结束.
我对NGINX有一个非常奇怪的问题.
我有以下upstream.conf
文件,上面有以下内容:
upstream files_1 {
least_conn;
check interval=5000 rise=3 fall=3 timeout=120 type=ssl_hello;
server mymachine:6006 ;
}
Run Code Online (Sandbox Code Playgroud)
在locations.conf中:
location ~ "^/files(?<command>.+)/[0123]" {
rewrite ^ $command break;
proxy_pass https://files_1 ;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
Run Code Online (Sandbox Code Playgroud)
在/ etc/hosts中:
127.0.0.1 localhost mymachine
Run Code Online (Sandbox Code Playgroud)
当我这样做时wget https://mynachine:6006/alive --no-check-certificate
,我明白了HTTP request sent, awaiting response... 200 OK
.我还验证了端口6006正在使用netstat进行监听,并且可以.
但是当我向NGINX文件服务器发送请求时,我收到以下错误:
连接上游时没有上游,客户端:..,请求:"POST/files/save/2 HTTP/1.1,上游:" https:// files_1/save "
但上游还可以.问题是什么?