common.conf 1.0 KB

12345678910111213141516171819202122232425
  1. map $http_x_forwarded_for $clientRealIp {
  2. "" $remote_addr;
  3. ~^(?P<firstAddr>[0-9\.]+),?.*$ $firstAddr;
  4. }
  5. #log format
  6. log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $clientRealIp';
  7. proxy_buffers 4 128k;
  8. proxy_connect_timeout 600; #nginx跟后端服务器连接超时时间(代理连接超时)
  9. proxy_read_timeout 600; #连接成功后,后端服务器响应时间(代理接收超时)
  10. proxy_send_timeout 600; #后端服务器数据回传时间(代理发送超时)
  11. proxy_busy_buffers_size 256k; #高负荷下缓冲大小(proxy_buffers*2)
  12. proxy_temp_file_write_size 1024k; #设定缓存文件夹大小,大于这个值,将从upstream服务器传
  13. proxy_cache_path /tmp/proxy_cache levels=1:2 keys_zone=cache_one:150m inactive=31d max_size=2g;
  14. #proxy_temp_path /tmp/proxy_cache/temp;
  15. error_log /data/log/error_openresty.log debug;
  16. include /etc/nginx/conf.d/vhost/*.conf;