2 - 4 - 운영 필수 핵심 기능 - nginx 웹 서비스 설정 실현

7980 단어 수송 하 다.51cto
                        
                12、keepalive_timeout timeout [header_timeout]
                               ,0       ,   75s
                13、keepalive_requests number
                                        ,   100,   12    0,      
                14、keepalive_disable none | browser ...
                               ,            ,       (    )
                15、send_timeout time---        ,         ,     
                                   ,  ,              
                           resolver_timeout---         
                16、client_body_buffer_size size---  nginx       post  ,       body,             (    ,    )
                                body        ;   16k;      ,           client_body_temp_path        (    IO,      )
                17、client_body_temp_path path [level1 [level2 [level3]]]
                                  body                  ---    url   hash  ,    hash  hash    (1 2 )        ,         ,           
                    16     
                    client_body_temp_path /var/tmp/client_body 2 1 1
                        1:     16           :0-f
                        2:   2 16           :00-ff
                        2:   2 16           :00-ff
                    echo http://www.ilinux.io/index.html | md5sum   1182a。。。。。。hash 
                         :
                18、limit_rate rate
                                 ,   bytes/second,0     
                             ,          
                19、limit_except method ... {...}---        get head post  ,       
                                           

                    limit_except GET {---  get       ,   ,      
                        allow 192.168.1.0/24;
                        deny all;
                    }
                     
                20、aio on | off |threads[=pool];---          ,     on
                        aio  ;
                21、directio size | off;---      ,       ,    
                     linux    O_DIRECT  ,                  ,  directio 4m;
                22、open_file_cache off;---         LRU,      
                    open_file_cache max=N [inactive=time];
                        nginx          :---                
                        (1)      ,              
                        (2)       
                        (3)                     
                        max=N:         ;        LRU  (      )      ---          ,      ,    
                        inactive=time:         ,                      open_file_cache_min_uses                  
                23、open_file_cache_valid time;
                               ;   60s
                24、open_file_cache_min_uses number;
                     open_file_cache   inactive        ,                   
                25、open_file_cache_errors on | off
                                       ;

            ngx_http_access_module  :
                    IP       
                26、allow address | CIDR |unix: | all;
                27、deny address | CIDR |unix: | all;
            ngx_http_auth_basic_module  
                           ,  basic        ;
                28、auth_basic string | off
                29、auth_basic_user_file file;
                    location /admin/ {
                        alias /webapps/app1/data/;
                        auth_basic "Admin Area";
                        auth_basic_user_file /etc/nginx/.ngxpasswd;
                    }
                      :htpasswd   httpd-tools   ;yum install -y httpd-tools
                    htpasswd -c -m /etc/nginx/.ngxpasswd tom---       ,   tom
                         :
                    location ~* ^/(admin|login) {--- admin login     
                        auth_basic "admin area or login url";
                        auth_basic_user_file /etc/nginx/.ngxpasswd;---        
                    }
                    mkdir /data/nginx/vhost1/admin
                    vim /data/nginx/vhost1/admin/index.html
                          ,             ,        admin area or login url32:00

                ngx_http_stub_status_module  ---nginx      
                        nginx       ;
                    Active connections:291
                    server accepts handled requests
                        16630948 16630948 31070465
                    Reading:6 Writing:179 Waiting:106

                    Active connections:        ;
                    accepts:             
                    handled:               ;
                    requests:           ;
                    Reading:                    
                    Writing:                   ;
                    Waiting:        、          ;

                    30、stub_status:---  ,         ,      ,   auth-basic  
                        :
                        location /basic_status {
                            stub_status;
                        }

                ngx_http_log_module  
                    he ngx_http_log_module module writes request logs in the specified format.

                    31、log_format name string ...;
                        string    nginx              ;
                            : nginx       httpd combined       ;
                    32、access_log path [format[buffer=size][gzip[=level]][flush=time][if=condition]];---     http    
                    access_log off;---      ,            
                                ,           ;
                        buffer=size---        ,           ,        
                        flush=time
                        gzip:          ,       cpu    ,     
                    33、open_log_file_cache max=N[inactive=time][min_uses=N][valid=time];
                    open_log_file_cache off;---      LRU
                            :         ,         
                                       ;

                        max:            ;
                        min_uses: inactive                      ;
                        inactive:     
                        valid:                    ;

                    ngx_http_gzip_module:---   cpu              ,       
                        The nbx_http_gzip_module module is a filter that compresses responses using the "gzip" method.This often helps to reduce the size of transmitted data by half or even more.

                        1、gzip on | off;
                            Enables or disables gzipping of responses.
                        2、gzip_comp_level level;---   1
                            Sets a gzip compression level of a response.Acceptable values are in the range from 1 to 9.
                        3、gzip_ddisable regex ...;---              
                            Disables gzipping of responses for requests with "User-Agent" header fields matching any of the specified regular expressions.
                        4、gzip_min_length length;---   20
                                           ;
                        5、gzip_buffers number size;
                            gzip_buffer 32 4k | 16 8k;
                                                        ;   ,     
                        6、gzip_proxied off | expired | no-cache | no-store | private | no_last_modified | no_etag | auth | any ...;
                            nginx                         ,             ;
                                off:         
                                no-cache,no-store,private:                   Cache-Control           ,       ;
                        7、gzip_types mime-type ...;
                                 ,       MIME           ;
                          :
                        gzip on;
                        gzip_proxy any;
                        gzip_types text/xml text/css application/javascript;

                        8、gzip_vary on | off;
                                         gzip,    Vary:Accept-Encoding           

                          :     gzip on,gzip_comp_level,gzip_types         ,       gzip_proxied

좋은 웹페이지 즐겨찾기