nginx 504 Gateway Time-out upstream timed out (10060求教怎么解决

烟雨凌 2015-04-21 05:16:50
nginx错误信息
2015/04/21 17:09:38 [error] 17880#16068: *1 upstream timed out (10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond) while connecting to upstream, client: 111.206.11.111, server: mooc.leyikao.net, request: "GET / HTTP/1.1", upstream: "http://192.168.2.128:8083/", host: "mooc.leyikao.net"

nginx配置:
#user nobody;
worker_processes 4;
#worker_cpu_affinity 0001 0010 0100 1000;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
worker_rlimit_nofile 204800;

pid logs/nginx.pid;



events {
worker_connections 204800;
accept_mutex off;
}


http {
include mime.types;
default_type application/octet-stream;
#charset utf-8;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

log_format access ‘$remote_addr – $remote_user [$time_local] “$request” ‘‘$status $body_bytes_sent “$http_referer” ‘‘”$http_user_agent” $http_x_forwarded_for’;
#access_log logs/access.log main;
#access_log logs/access.log access;
#error_log logs/error.log debug;

ignore_invalid_headers on;

server_names_hash_bucket_size 128;
client_header_buffer_size 2k;
large_client_header_buffers 4 4k;

sendfile on;
tcp_nopush on;

keepalive_timeout 60;

gzip on;
gzip_proxied any;
gzip_min_length 1k;
gzip_types text/plain application/x-javascript text/css application/xml application/json image/png image/jpeg image/gif;
gzip_vary on;
gzip_http_version 1.0;
gzip_comp_level 2;

proxy_connect_timeout 60;
proxy_read_timeout 60;
proxy_send_timeout 60;
proxy_buffer_size 128k;
proxy_buffers 8 128k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;

userid on;
userid_name uid;
userid_domain .leyikao.net;
userid_path /;
userid_expires 1d;
userid_p3p 'policyref="/w3c/p3p.xml", CP="CUR ADM OUR NOR STA NID"';
upstream mooc.leyikao.net {
ip_hash;
server 192.168.2.128:8083;

keepalive 16;
}
erver {
listen 80;
server_name mooc.leyikao.net;

#charset koi8-r;

#access_log logs/host.access.log main;
#

server_tokens off;
add_header X-Frame-Options "SAMEORIGIN";
#add_header X-Content-Type-Options "nosniff";

if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}

if ($http_user_agent ~* LWP::Simple|BBBike|wget) {
return 403;
}

if ($http_user_agent ~* msnbot|scrapbot) {
return 403;
}

location /favicon.ico {
root html;
expires 30d;
}

location / {
allow all;
proxy_redirect off;
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_pass http://mooc.leyikao.net;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Connection "";
}

location ~* \.(png|jpg|jpeg|gif)$ {
expires 30d;
log_not_found off;
root /usr/local/tomcat_mooc/webapps/Mooc/;
}

location ~* \.(js|css)$ {
expires 2h;
log_not_found off;
root /usr/local/tomcat_mooc/webapps/Mooc/;
}

}



用ip:192.168.2.128:8083可以正常访问
求教怎么解决呀
...全文
1012 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sscel 2015-05-10
  • 打赏
  • 举报
回复
我也遇到同样的问题,但是偶尔才出现这个问题,重启应用服务器又正常了,正在查看原因。。。。

5,655

社区成员

发帖
与我相关
我的任务
社区描述
Web开发应用服务器相关讨论专区
社区管理员
  • 应用服务器社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧