- 首页 > it技术 > >
failed (111: Connection refused) while connecting to upstream
nginx的主配置文件就照着下面配置,基本技能解决问题
userroot;
worker_processes4;
error_loglogs/error.log notice;
events {
worker_connections65535;
}
http {
default_typeapplication/octet-stream;
log_formatmain'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_loglogs/access.logmain;
port_in_redirectoff;
sendfileon;
tcp_nopushon;
tcp_nodelayon;
gzipon;
gzip_min_length5k;
gzip_buffers4 16k;
gzip_http_version 1.0;
gzip_comp_level 4;
gzip_typestext/plain application/x-javascript application/javascripttext/cssapplication/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
keepalive_timeout65;
client_body_timeout12;
client_header_timeout12;
send_timeout10;
include conf.d/*.conf;
}
userroot;
worker_processes4;
worker_rlimit_nofile 65535;
error_loglogs/error.log error;
events {
use epoll;
worker_connections65535;
}http {
includemime.types;
default_typeapplication/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_loglogs/access.logmain;
sendfileon;
client_max_body_size 256m;
server_tokens off ;
proxy_intercept_errors on;
keepalive_timeout30;
gzipon;
gzip_min_length5k;
gzip_buffers4 16k;
gzip_http_version 1.0;
gzip_comp_level 4;
gzip_typestext/plain application/x-javascript application/javascripttext/cssapplication/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
includeconf.d/*.conf;
fastcgi_intercept_errors on;
}
推荐阅读