客户端配置
http { include mime.types; 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; sendfile on; #tcp_nopush on; #keepalive_timeout 0;# ###################################################### keepalive_timeout 65; keepalive_timeout 65; #超过这个时间没有活动,会让keepalive失效 keepalive_time 1h; #一个tcp连接总时长,超过之后,强制失效 send_timeout 60;#默认60s,此处有坑,系统中若有耗时操作,超过send_timeout强制断开连接 #是准备过程中,不是传输过程 keepalive_requests 1000;#一个tcp复用中,可以并发接收的请求个数 ###################################################### #gzip on; upstream httpd_get { ip_hash; server 192.168.44.102; server 192.168.44.103; server 192.168.44.104; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #正则方式 rewrite ^/[0-9].html$ /index.jsp?pageNum=$1 break; proxy_pass http://httpd_get; #proxy_pass配置下 root 不生效 } location ~*/(css|js|) { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
上游服务配置
http { include mime.types; 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; sendfile on; #tcp_nopush on; #keepalive_timeout 0;# #################客户端############################### keepalive_timeout 65; keepalive_timeout 65; #超过这个时间没有活动,会让keepalive失效 keepalive_time 1h; #一个tcp连接总时长,超过之后,强制失效 send_timeout 60;#默认60s,此处有坑,系统中若有耗时操作,超过send_timeout强制断开连接 #是准备过程中,不是传输过程 keepalive_requests 1000;#一个tcp复用中,可以并发接收的请求个数 #################客户端##################################### #gzip on; upstream httpd_get { #################上游服务############################### keepalive 100; #上游服务器保证的连接数 keepalive_requests 1000; keepalive_timeout 65; #################上游服务############################### server 192.168.44.102; server 192.168.44.103; server 192.168.44.104; } server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #################上游服务############################### proxy_http_version 1.1; proxy_set_header Connection ""; #################上游服务############################### proxy_pass http://httpd_get; #proxy_pass配置下 root 不生效 } location ~*/(css|js|) { root html; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
标签:http,log,server,nginx,html,timeout,keepalive From: https://www.cnblogs.com/smatter/p/17043435.html