http {
keepalive_timeout 1800s; #指定 KeepAlive 的逾時時間(timeout)。指定每個 TCP 連接配接最多可以保持多長時間。Nginx 的預設值是 75 秒,有些浏覽器最多隻保持 60 秒,是以可以設定為 60 秒。若将它設定為 0,就禁止了 keepalive 連接配接。
proxy_connect_timeout 1800s; #nginx跟後端伺服器連接配接逾時時間(代理連接配接逾時)
proxy_send_timeout 1800s; #後端伺服器資料回傳時間(代理發送逾時)
proxy_read_timeout 1800s; #連接配接成功後,後端伺服器響應時間(代理接收逾時)
fastcgi_connect_timeout 1800s; #指定nginx與後端fastcgi server連接配接逾時時間
fastcgi_send_timeout 1800s; #指定nginx向後端傳送請求逾時時間(指已完成兩次握手後向fastcgi傳送請求逾時時間)
fastcgi_read_timeout 1800s; #指定nginx向後端傳送響應逾時時間(指已完成兩次握手後向fastcgi傳送響應逾時時間)
}
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" $request_time $upstream_response_time ';
access_log logs/access.log main;
client_header_buffer_size 64k;
large_client_header_buffers 8 64k;
client_max_body_size 200m;
client_body_buffer_size 8M;
#清理緩存
sendfile off;
# sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 1200;
proxy_connect_timeout 50000;
#proxy_connect_timeout 500;
proxy_read_timeout 60000;
#proxy_send_timeout 500;
proxy_send_timeout 50000;
#fastcgi_buffers 80 128k;
fastcgi_connect_timeout 30000;
fastcgi_send_timeout 30000;
fastcgi_read_timeout 30000;
send_timeout 6000;
proxy_buffer_size 96k;
#proxy_buffer_size 16k;
proxy_buffers 4 64k;
#proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 128k;
proxy_temp_path /data/nginx/proxy_temp;
proxy_cache_path /data/nginx/proxy_cache levels=1:2 keys_zone=content:20m inactive=1d max_size=100m;
proxy_cache_bypass $http_secret_header;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml application/javascript;