Nginx nginx. conf 프로필 중국어 설명

6805 단어
 
  
 #
    user www-data;   
    # , cpu
    worker_processes  1;
 
    # PID
    error_log  /var/log/nginx/error.log;
    pid        /var/run/nginx.pid;
 
    #
    events {
        use   epoll;             #epoll IO(I/O Multiplexing) , linux2.6 , nginx
        worker_connections  1024;# worker process
        # multi_accept on;
    }
 
    # http ,
    http {
         # mime , mime.type
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        #
        access_log    /var/log/nginx/access.log;
 
        #sendfile nginx sendfile (zero copy ) , ,
        # on, IO , off, I/O , uptime.
        sendfile        on;
        #tcp_nopush     on;
 
        #
        #keepalive_timeout  0;
        keepalive_timeout  65;
        tcp_nodelay        on;
       
        # gzip
        gzip  on;
        gzip_disable "MSIE [1-6]\.(?!.*SV1)";
 
        #
        client_header_buffer_size    1k;
        large_client_header_buffers  4 4k;
 
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
 
        #
         upstream mysvr {
        #weigth ,
        # Squid 3128
        server 192.168.8.1:3128 weight=5;
        server 192.168.8.2:80  weight=1;
        server 192.168.8.3:80  weight=6;
        }
 
 
       server {
        # 80
            listen       80;
            # www.xx.com
            server_name  www.xx.com;
 
            #
            access_log  logs/www.xx.com.access.log  main;
 
        #
        location / {
              root   /root;      #
              index index.php index.html index.htm;   #
 
              fastcgi_pass  www.xx.com;
             fastcgi_param  SCRIPT_FILENAME  $document_root/$fastcgi_script_name;
              include /etc/nginx/fastcgi_params;
            }
 
        #
        error_page   500 502 503 504 /50x.html; 
            location = /50x.html {
            root   /root;
        }
 
        # ,nginx
        location ~ ^/(images|javascript|js|css|flash|media|static)/ {
            root /var/www/virtual/htdocs;
            # 30 , , , , 。
            expires 30d;
        }
        #PHP FastCGI . FastCGI .
        location ~ \.php {
            root /root;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /home/www/www$fastcgi_script_name;
            include fastcgi_params;
        }
        # Nginx
        location /NginxStatus {
            stub_status            on;
            access_log              on;
            auth_basic              "NginxStatus";
            auth_basic_user_file  conf/htpasswd;
        }
        # .htxxx
        location ~ /\.ht {
            deny all;
        }
        
         }
    }
 
, Nginx
 
, http :
 
    # http ,
    http {
         # mime , mime.type
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
        #
        access_log    /var/log/nginx/access.log;
 
        #
 
        #。。。。。。。。。。
 
        #
         upstream mysvr {
        #weigth ,
        server 192.168.8.1x:3128 weight=5;# Squid 3128
        server 192.168.8.2x:80  weight=1;
        server 192.168.8.3x:80  weight=6;
        }
 
       upstream mysvr2 {
        #weigth ,
 
        server 192.168.8.x:80  weight=1;
        server 192.168.8.x:80  weight=6;
        }
 
       #
       server {
        # 192.168.8.x 80
            listen       80;
            server_name  192.168.8.x;
 
          # aspx
        location ~ .*\.aspx$ {
 
             root   /root;      #
              index index.php index.html index.htm;   #
 
              proxy_pass  http://mysvr ;# mysvr
 
              # .
 
              proxy_redirect off;
 
              # Web X-Forwarded-For IP
              proxy_set_header Host $host;
              proxy_set_header X-Real-IP $remote_addr;
              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              client_max_body_size 10m;    #
              client_body_buffer_size 128k;  # ,
              proxy_connect_timeout 90;  #nginx ( )
              proxy_send_timeout 90;        # ( )
              proxy_read_timeout 90;         # , ( )
              proxy_buffer_size 4k;             # (nginx)
              proxy_buffers 4 32k;               #proxy_buffers , 32k ,
              proxy_busy_buffers_size 64k;    # (proxy_buffers*2)
              proxy_temp_file_write_size 64k;  # , , upstream
 
           }
 
         }
    }

좋은 웹페이지 즐겨찾기