nginx 프로필 소개

4260 단어
user  www www;  //     ,user          ,  nobody

worker_processes auto;   //     ,  nginx    

error_log  /home/wwwlogs/nginx_error.log  crit; //     ,          ,    crit   

pid        /usr/local/nginx/logs/nginx.pid; //     ,    id        

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200; //  worker   cpu

events  //nginx            
    {
        use epoll; //        nginx     select poll        ,kqueue epoll    
                   //      epoll   linux  kqueue  BSD  。 epoll  。
        worker_connections 51200; //       nginx          ,  1024 
        multi_accept on;
    }

http
    {
        include       mime.types;  //            
        default_type  application/octet-stream;  //http       

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;//        headerbuffer  
        large_client_header_buffers 4 32k;//                         
        client_max_body_size 50m; //               

        sendfile on; //           
        tcp_nopush     on; //      

        keepalive_timeout 60;  //           

        tcp_nodelay on; //      

        fastcgi_connect_timeout 300; //       FastCGI     
        fastcgi_send_timeout 300; //   FastCGI         ,              FastCGI         。
        fastcgi_read_timeout 300; //    FastCGI       ,               FastCGI       。
        fastcgi_buffer_size 64k; //      FastCGI              ,        1 64KB             (   ),     fastcgi_buffers          。
        fastcgi_buffers 4 64k;  //                   FastCGI     。    PHP 
          256KB,       4 64KB       ;        256KB,    256KB       
fastcgi_temp      ,         ,                 。           PHP           
   ,                  256KB,           “1616k”、“464k” 。
        fastcgi_busy_buffers_size 128k; //     fastcgi_buffers   
        fastcgi_temp_file_write_size 256k; //                  ,    fastcgi_buffers   。
        
        #HttpGzip  ,             。
        gzip on; //  
        gzip_min_length  1k; //              。
        gzip_buffers     4 16k; //     16k            。
        gzip_http_version 1.0; //http    
        gzip_comp_level 2; //gzip   ,1     ,      
        gzip_types       text/plain application/x-javascript text/css application/xml; //       
        gzip_vary on;   //      ,gzip
        gzip_proxied        expired no-cache no-store private auth;
        gzip_disable        "MSIE [1-6]\.";

        #limit_conn_zone $binary_remote_addr zone=perip:10m;
        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

        server_tokens off;
        #log format
        //httplog    ,  nginx       。
        log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '  
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';

        #nginx     
        upstream www.lnmp.org    
        {    
        server 192.168.5.225:80;    
        server 192.168.5.226:80;    
        }    
        #   

 
server
    {
        listen 80 default; //80  , default    
        #listen [::]:80 default ipv6only=on; 
        server_name  //     IP 
        index index.html index.htm index.php; //       
        root  /home/wwwroot/default; //     
        
        #error_page   404   /404.html;  //   
        location ~ [^/]\.php(/|$)
            {
                # comment try_files $uri =404; to enable pathinfo
                try_files $uri =404;
                fastcgi_pass  unix:/tmp/php-cgi.sock;
                fastcgi_index index.php;
                include fastcgi.conf;
                #include pathinfo.conf;
            }

        location /nginx_status {
            stub_status on;
            access_log   off;
        }

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ //        
            {
                expires      30d;  //  30 
            }

        location ~ .*\.(js|css)?$ //   .js   .css       
            {
                expires      12h; //  12  
            }

        access_log  /home/wwwlogs/access.log  access;  //            access     
    }
include vhost/*.conf;
}

we

좋은 웹페이지 즐겨찾기