502 Bad Gateway - 连接到上游时connect()失败(111:连接被拒绝)

时间:2014-07-07 10:22:31

标签: nginx

我一直在我们的服务器上收到错误。 nginx.conf文件如下所示:

worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240;

events {
    use epoll;
    worker_connections  10240;
    multi_accept on;
}

http {

    include /etc/nginx/mime.types;
    default_type application/force-download;
    server_names_hash_bucket_size 128;

    # Description of supported access log formats
    log_format main '$remote_addr - $remote_user [$time_local - upstream_response_time] $status "$request" $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';

    log_format common '$remote_addr - - [$time_local - $upstream_response_time] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" $msec';

    log_format debug '$upstream_response_time,"$time_local","$remote_addr","$request",$status,$body_bytes_sent';

    # Disable request logging in nginx by default
    #access_log /var/log/nginx/access.log  common;
    access_log                      off;

    sendfile                        on;
    tcp_nopush                      on;
    tcp_nodelay                     on;

    client_max_body_size            1024m;
    client_body_buffer_size         64m;

    # Parameters for back-end request proxy
    proxy_connect_timeout           5000;
    proxy_send_timeout              5000;
    proxy_read_timeout              5000;
    proxy_buffer_size               256k;
    proxy_buffers                   8 512k;
    proxy_busy_buffers_size         756k;
    proxy_temp_file_write_size  10m;

    keepalive_requests 100000;
    keepalive_timeout 30;
    send_timeout 2;

    # Assign default error handlers
    error_page 500 502 503 504 /500.html;
    error_page 404 = /404.html;

    # Content compression parameters
    gzip                            on;
    gzip_proxied                    any;
    gzip_static                     on;
    gzip_http_version               1.0;
    gzip_types                      application/x-javascript text/css;

    add_header "X-Content-Type-Options" "nosniff";

我们在服务器上有多个站点,错误日志如下所示:

*68244 connect() failed (111: Connection refused) while connecting to upstream, client:
*53345 connect() failed (111: Connection refused) while connecting to upstream, client:
*68209 connect() failed (111: Connection refused) while connecting to upstream, client: 

我们每小时都会发生几次这样的事情。感谢您的帮助。

0 个答案:

没有答案