在没有任何日志记录的情况下,Nginx在代理\u过程中超时
我使用NGINX对我的Ruby-On-Rails应用程序进行反向代理/负载平衡,在使用fastcgi的其他php应用程序的服务器上,它们没有任何问题。 我有NGINX的问题,只是停止服务连接,它不会出现在任何访问日志或错误日志中 当我点击我的应用程序时,我注意到了这个问题,在nginx和unicorn中,出现了一个超时错误,而这个错误根本没有出现在日志中 我测试了如何从一个套接字切换到另一个端口,并对该端口进行基准测试,这很有效,但如果我将其切换到nginx,则大多数端口甚至所有端口都将失败 我的nginx配置如下所示:在没有任何日志记录的情况下,Nginx在代理\u过程中超时,nginx,proxy,Nginx,Proxy,我使用NGINX对我的Ruby-On-Rails应用程序进行反向代理/负载平衡,在使用fastcgi的其他php应用程序的服务器上,它们没有任何问题。 我有NGINX的问题,只是停止服务连接,它不会出现在任何访问日志或错误日志中 当我点击我的应用程序时,我注意到了这个问题,在nginx和unicorn中,出现了一个超时错误,而这个错误根本没有出现在日志中 我测试了如何从一个套接字切换到另一个端口,并对该端口进行基准测试,这很有效,但如果我将其切换到nginx,则大多数端口甚至所有端口都将失败 我
upstream unicorn_app_production {
#server unix:/tmp/unicorn.app_production.sock;
server localhost:8080;
}
server {
listen 80;
client_max_body_size 4G;
keepalive_timeout 600s;
error_page 500 502 504 /500.html;
error_page 503 @503;
server_name dev.app.com;
server_name_in_redirect off;
port_in_redirect off;
root /var/www/rails.app.com/current/public;
#try_files $uri/index.html $uri @unicorn_app_production;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn_app_production;
#proxy_read_timeout 180s;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
proxy_next_upstream error;
# limit_req zone=one;
access_log /var/log/nginx/app_production.access.log;
error_log /var/log/nginx/app_production.error.log;
}
...
}
/# siege -c 5 -r 5 http://dev.app.com
** SIEGE 2.70
** Preparing 5 concurrent users for battle.
The server is now under siege...socket: connection timed out
socket: connection timed out
socket: connection timed out
socket: connection timed out
socket: connection timed out
^C
Lifting the server siege... done.
Transactions: 10 hits
Availability: 66.67 %
Elapsed time: 39.52 secs
Data transferred: 0.03 MB
Response time: 0.10 secs
Transaction rate: 0.25 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.03
Successful transactions: 10
Failed transactions: 5
Longest transaction: 0.13
Shortest transaction: 0.05
我使用Sakege测试nginx是否可以处理我的连接:
围城-c5-r5http://dev.app.com:8080
直接连接到麒麟,不带8080的连接到nginx。直接到unicorn工作没有任何问题,但对于nginx,它将如下所示:
upstream unicorn_app_production {
#server unix:/tmp/unicorn.app_production.sock;
server localhost:8080;
}
server {
listen 80;
client_max_body_size 4G;
keepalive_timeout 600s;
error_page 500 502 504 /500.html;
error_page 503 @503;
server_name dev.app.com;
server_name_in_redirect off;
port_in_redirect off;
root /var/www/rails.app.com/current/public;
#try_files $uri/index.html $uri @unicorn_app_production;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn_app_production;
#proxy_read_timeout 180s;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
proxy_next_upstream error;
# limit_req zone=one;
access_log /var/log/nginx/app_production.access.log;
error_log /var/log/nginx/app_production.error.log;
}
...
}
/# siege -c 5 -r 5 http://dev.app.com
** SIEGE 2.70
** Preparing 5 concurrent users for battle.
The server is now under siege...socket: connection timed out
socket: connection timed out
socket: connection timed out
socket: connection timed out
socket: connection timed out
^C
Lifting the server siege... done.
Transactions: 10 hits
Availability: 66.67 %
Elapsed time: 39.52 secs
Data transferred: 0.03 MB
Response time: 0.10 secs
Transaction rate: 0.25 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 0.03
Successful transactions: 10
Failed transactions: 5
Longest transaction: 0.13
Shortest transaction: 0.05
问题是什么?我做错了什么
注:证明我的独角兽工作完全正常:
/# siege -c 20 -r 6 http://dev.app.com:8080
** SIEGE 2.70
** Preparing 20 concurrent users for battle.
The server is now under siege.. done. Transactions: 120 hits
Availability: 100.00 %
Elapsed time: 4.63 secs
Data transferred: 1.32 MB
Response time: 0.12 secs
Transaction rate: 25.92 trans/sec
Throughput: 0.29 MB/sec
Concurrency: 2.99
Successful transactions: 120
Failed transactions: 0
Longest transaction: 0.28
Shortest transaction: 0.05
将nginx错误日志级别提高到INFO或DEBUG:这有帮助吗?尝试了一下,但没有成功。它没有出现。我想知道是不是nginx之外的东西现在阻止了它。我不确定。