cat nginx.conf
##
ユーザー webroot webroot;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 102400;
events {
use epoll;
worker_connections 204800;
}
http {
include mime.types;
default_type 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 max=102400 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
client_max_body_size 8m;
tcp_nopush on;
tcp_nolay on;
gzip をオンにします。
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_バージョン 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary をオンにします。
fastcgi_cache_path /service/nginx/fastcgi_cache レベル=1:2 key_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_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
##
サーバー {
listen 80;
サーバー名 www.zhoupeihao.com zhoupeihao.com;
root /data/web/www;
インデックス index.htmlindex.phpindex.htm shtml;
場所/ {
try_files $uri $uri/ /index.php?$args;
}
location /ngx_status
{
stub_status on;
access_log off;
}
場所 ~ .*.( php)?$
{
有効期限は-1s;
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
include fastcgi_params;
fastc gi_param PATH_INFO $fastcgi_path_info;
fastcgi_indexindex.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_cache fcgi;
fastcgi_cache_valid 200 1時間;
fastcgi_cache_valid 301 1d;
fastcgi_cache_valid 任意 1m;
fastcgi_cache_min_uses 1;
fastcgi_cache_use_stale エラー タイムアウト valid_header http_500;
}
}
}
cat >>/etc/sysctl.conf <
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
EO F
版权:本文はこちら博主原文、博主はダウンロードを許可していません。
以上は、側面の内容を含む Nginx の拡張構成について説明しましたが、PHP の教則に関心のある友人の助けになることを望みます。