标签:nginx
参考http://www.ttlsa.com/nginx/use-nginx-proxy/
配置
1.要想能记录真实IP,需要修改后端机器的日志格式,这里假设后端也是一台nginx:
在后端配置文件里面加入这一段即可:
log_format access ‘$HTTP_X_REAL_IP - $remote_user [$time_local] "$request" ‘
‘$status $body_bytes_sent "$http_referer" ‘
‘"$http_user_agent" $HTTP_X_Forwarded_For‘;
access_log logs/access.log access;
故障
之前没配置下面这段,访问时候偶尔会出现504 gateway timeout,由于偶尔出现,所以不太好排查
proxy_connect_timeout 300s;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
proxy_ignore_client_abort on;
待添加
本文出自 “人,要有自己的想法” 博客,请务必保留此出处http://szgb2016.blog.51cto.com/340201/1834387
标签:nginx
原文地址:http://szgb2016.blog.51cto.com/340201/1834387