failed (111: Connection refused) while connecting to upstream

nginx的主配置文件就照着下面配置,基本技能解决问题
user  root;
worker_processes  4;
 
error_log  logs/error.log notice;
 
events {
    worker_connections  65535;
}
 
http {
    default_type  application/octet-stream;
 
    log_format  main  '$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;
    
    port_in_redirect  off;
    
    sendfile  on;
    tcp_nopush  on;
    tcp_nodelay  on;
 
    gzip  on;
    gzip_min_length  5k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 4;
    gzip_types  text/plain application/x-javascript application/javascript  text/css  application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";


    keepalive_timeout  65;
    client_body_timeout  12;
    client_header_timeout  12;
    send_timeout  10;
    include conf.d/*.conf;
 
}

  • 下面为之前出问题的nginx配置

user  root;
worker_processes  4;
worker_rlimit_nofile 65535;
error_log  logs/error.log error;
events {
    use epoll;
    worker_connections  65535;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format main   '{"@timestamp":"$time_iso8601",'
                        '"@source":"$server_addr",'
                        '"hostname":"$hostname",'
                        '"ip":"$http_x_forwarded_for",'
                        '"client":"$remote_addr",'
                        '"request_method":"$request_method",'
                        '"scheme":"$scheme",'
                        '"domain":"$server_name",'
                        '"referer":"$http_referer",'
                        '"request":"$request_uri",'
                        '"args":"$args",'
                        '"size":$body_bytes_sent,'
                        '"status": $status,'
                        '"responsetime":$request_time,'
                        '"upstreamtime":"$upstream_response_time",'
                        '"upstreamaddr":"$upstream_addr",'
                        '"http_user_agent":"$http_user_agent",'
                        '"https":"$https"'
                        '}';

    access_log  logs/access.log  main;

    sendfile        on;
    client_max_body_size 256m;
    server_tokens off ;
    proxy_intercept_errors on;
    keepalive_timeout  30;

    gzip  on;
    gzip_min_length  5k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 4;
    gzip_types  text/plain application/x-javascript application/javascript  text/css  application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.";
    include     conf.d/*.conf;
    fastcgi_intercept_errors on;

}

你可能感兴趣的:(nginx)