Nginx 최적화 구성

WBOY
풀어 주다: 2016-08-08 09:21:45
원래의
955명이 탐색했습니다.

cat nginx.conf
##
사용자 webroot webroot;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 100 00000; 
worker_rlimit_nofile 102400;
이벤트 {
    epoll 사용;
    Worker_connections  204800;
}
http {
    include       mime.types;
    default_type  application/oc 테트 스트림;
    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 비활성 = 20S;
Open_File_CACHE_VALID 30S; >open_file_cache_min_uses 1;
client_max_body_size 8m;       
tcp_nopush     on;
tcp_nodelay on; 
gzip을 사용하세요. 
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; 
gzip_vary on; 
fastcgi_cache_path /service/nginx/fastcgi_cache 레벨=1:2keys_z 비활성=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; ##    서버 {
        듣기       80;        server_name  www.zhoupeihao.com zhoupeihao.com;

root   /data/web/www;
           색인 index.html index.php index.htm index.shtml;
        
        위치 / {            try_files $uri $uri/ /index.php?$args;

}
   

위치 /ngx_status
{        stub_status on;        access_log off;
    }        
       위치 ~ .* .(php)?$
        {
        만료 -1s;        try_files $uri =404;        fastcgi_split_path_info ^(.+.php)(/.+)$;
        include fastcgi_params;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1 :9000;


fastcgi_cache fcgi;


fastcgi_cache_valid 200 302 1시간; 
fastcgi_cache_valid 301     1d; 
fastcgi_cache_valid 모든     1분; 
fastcgi_cache_min_uses 1; 
fastcgi_cache_use_stale 오류 시간 초과 valid_header http_500;         }    }
}cat >>/etc/sysctl.conf <#for web
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_ 재시도 = 1 
net.ipv4.tcp_syn_retries = 1 
net.ipv4.tcp_fin_timeout = 1 
net.ipv4.tcp_keepalive_time = 30 
EOF


版权声明:本文为博主原创文章,未经博主允许不得转载。


以上就介绍了Nginx는 包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!