cat nginx.conf
##
用戶 webroot webroot;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00;
worker_rlimit_nofile 102400;
events {
使用 epoll;
worker_connections 204800;
}
http {豆 application/octet-stream;
sendfile on;
keepalive_timeout 60;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
open_file_cache_min_uses 1;
client_max_body_size 8m;
tcp_nopush
tcp_nopush 開膜; tcp_nodelay 開;
gzip 開啟;
gzip_min_length 1k;
gzip_buffers 1k;
gzip_buffers
gzip_ comp_level 2;
gzip_types 文字/普通應用程式/x- javascript文字/css 應用程式/xml;
gzip_vary 開啟;
fastcgi_cache_path /service/nginx/fastcgi_cache level=1:2keys_z inactive=5m max_size=1g;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 8 64k;
fastcgi_bus y_buffers_size 128k;
fastcgi_temp_file_write_size 128k; ## 服務器 {
80; server_name www .周培豪.com 週培豪.com;
root /data/web/www;
index index.html index.php index.htm html; try_files $uri $uri /index.php ?$ args ;
}
location /ngx_status
{ Stub_status on; 集 位置~ .*.( php)?$
{ 過渡-1秒; 過渡-秒;
=404; fastcgi_split_path_info ^(.+.php)(/.+)$; include fastcgi_params; cgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000 _valid 200 302 1h;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid 約 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale 錯誤逾時 invalid_er
fastcgi_cache_use_stale 錯誤發生錯誤;
} }}
cat >>/etc/sysctl.conf #for webnet.ipv4.tcp_max_tw_buckets = 6000610. ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1 net.ipv4.tcp_syncookies = 1 net.core.somaxconn = 262144 _orphans = 262144
net .ipv4。 tcp_max_syn_backlog = 262144 net.ipv4.tcp_timestamps = 0 net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_plateries = 1.48. keepal ive_time = 30 EOF
版權聲明:文字為部落客原創文章,部落客不允許轉載。
以上就介紹了Nginx優化配置,包括了方面的內容,希望對PHP教程有興趣的朋友得到幫助。