我们有一个用TCL编写的应用程序,并使用wibble服务器提供服务。这太可怕了,我想把nginx放在前面,这样我就可以将像/assets这样的代理路径代理到像链轮这样的资产服务器,并将/help代理到gollum服务器或somesuch。
Wi球运行在端口8080上,nginx运行在端口80上,资产服务器运行在端口9292上(来自netstat -tulpna的输出如下所示):
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 27599/nginx
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1536/tclsh8.6
tcp 0 0 0.0.0.0:9292 0.0.0.0:* LISTEN 28941/rack 操作系统是Debian,因此/etc/nginx/sites-available/site上的配置文件被链接到sites-enabled (唯一链接的文件)目录中,nginx已经重新启动。
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_read_timeout 120;
}
location /images {
proxy_pass http://127.0.0.1:9292/images/;
}
location /css {
proxy_pass http://127.0.0.1:9292/stylesheets/;
}
location /js {
proxy_pass http://127.0.0.1:9292/javascripts/;
}
}问题是,当我运行nginx并导航到端口80时,资产服务器可以很好地完成它的工作,但是wi球服务器从不回复,导致nginx给出/var/log/nginx/error.log中的/var/log/nginx/error.log错误(服务器是192.168.3.127,我是192.168.3.90):
2014/07/07 12:07:29 [error] 27601#0: *1 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: localhost, request: "GET /nginx-status HTTP/1.1", upstream: "http://127.0.0.1:8080/nginx-status", host: "localhost"
2014/07/07 12:07:59 [error] 27601#0: *3 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.3.90, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "192.168.3.127"
2014/07/07 12:10:00 [error] 27601#0: *3 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.3.90, server: localhost, request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:8080/favicon.ico", host: "192.168.3.127"
2014/07/07 12:10:34 [error] 27601#0: *7 upstream timed out (110: Connection timed out) while reading upstream, client: 127.0.0.1, server: localhost, request: "GET /nginx-status HTTP/1.1", upstream: "http://127.0.0.1:8080/nginx-status", host: "localhost"在/var/log/nginx/access.log中也有这些行
192.168.3.90 - - [07/Jul/2014:12:06:19 +1200] "-" 400 0 "-" "-"
127.0.0.1 - - [07/Jul/2014:12:07:29 +1200] "GET /nginx-status HTTP/1.1" 404 0 "-" "Python-urllib/2.6"
192.168.3.90 - - [07/Jul/2014:12:07:59 +1200] "GET / HTTP/1.1" 200 31 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/34.0.1847.116 Chrome/34.0.1847.116 Safari/537.36"Hangon,它为什么要获得这个不存在的/nginx-status URI?Wi球服务器正在8080端口上运行。
如果我停止wi球服务器,并在同一个端口(8080)上加载一个简单的python服务器,它就会工作得很好!
我仍然可以通过访问http://192.168.3.127:8080访问wibble,甚至通过在服务器上执行curl http://127.0.0.1:8080,它也可以打印出正确的HTML。
为什么不是回复nginx,而是回复浏览器和curl?
(我正在尝试对输出日志进行处理)
发布于 2014-07-07 03:01:48
在将其请求对象转储之后,我发现HTTP被设置为1.0,尽管这似乎并没有影响curl -0从HTML中提取出来。
在将nginx升级到最新版本之后,一切正常。
https://stackoverflow.com/questions/24601571
复制相似问题