nginx生產配置文件參考 解決http 499 問題,解決銀聯回調 異常,每次請求第一次失敗,第二次成功,每次都要等三分鐘,主要添加參數是優化buffer\cache,還有超時時間,javascript
1,查看DNS 【服務器本地DNS、局域網bindDNS,CDN解析,域名映射,NAT等】
2,查看nginx 鏈接狀態,TCP11種狀態,是否存在主動丟棄鏈接
3,查看nginx配置 是否存在優化項,特唄注意 timeout、ignore_client_abort,fastcgi端口跳轉等等css
##-------------------------------------------------------------------------- user www www; worker_processes 4; error_log /home/logs/nginx_error.log notice; pid /var/run/nginx.pid; worker_rlimit_nofile 6553; ##-------------------------------------------------------------------------- events { use epoll; worker_connections 5120; multi_accept on; } ##-------------------------------------------------------------------------- http { include mime.types; #include secure/limit_zone.conf; default_type application/octet-stream; server_tokens off; server_names_hash_bucket_size 128; client_header_buffer_size 512k; client_body_buffer_size 1024k; large_client_header_buffers 4 32k; client_max_body_size 50m; sendfile on; tcp_nopush on; keepalive_timeout 300; tcp_nodelay on; ##-------------------------------------------------------------------------- fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_ignore_client_abort on; fastcgi_buffer_size 512k; fastcgi_buffers 6 512k; fastcgi_busy_buffers_size 512k; fastcgi_temp_file_write_size 512k; fastcgi_next_upstream error timeout invalid_header http_500 http_503 http_403; ##-------------------------------------------------------------------------- gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.1; gzip_comp_level 4; gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; gzip_vary on; gzip_proxied expired no-cache no-store private auth; gzip_disable "MSIE [1-6]\."; proxy_connect_timeout 3; proxy_read_timeout 60; proxy_send_timeout 60; ###-------------------------------------------------------------------------- log_format main '$remote_addr - $remote_user [$time_local] "$request"' '$status $body_bytes_sent "$http_referer"' '"$http_user_agent" "$http_x_forwarded_for"'; ##-------------------------------------------------------------------------- upstream myfastcgi { ip_hash; server 192.168.0.32:9000 weight=1; } ##-------------------------------------------------------------------------- include vhost/*.conf; log_format json '{ "@timestamp": "$time_local", ' '"@fields": { ' '"remote_addr": "$remote_addr", ' '"remote_user": "$remote_user", ' '"body_bytes_sent": "$body_bytes_sent", ' '"request_time": "$request_time", ' '"status": "$status", ' '"request": "$request", ' '"request_method": "$request_method", ' '"http_referrer": "$http_referer", ' '"body_bytes_sent":"$body_bytes_sent", ' '"http_x_forwarded_for": "$http_x_forwarded_for", ' '"http_user_agent": "$http_user_agent" } }'; access_log /var/log/nginx/access_json.log json; } ##--------------------------------------------------------------------------