Nginx 프로필 - 3
  :
allow
deny
    :
http, server, location, limit_except
    :
server {
    server_name www.a.com;
    listen 80;
    root /web/a.com;
    index index.html;
    server_tokens off;
    location /test {
        root /www/html;
        deny 172.20.23.23;
        allow 172.20.23.33;
        deny all;
    }
    location /test1 {
        alias /mydata/html;
    }
}
    :
[root@www21:17:48~]#curl http://www.a.com/test/ 
test location page for nginx
    :
allow 172.20.23.33; --->  deny
  :
[root@www21:21:16~]#curl http://www.a.com/test/ 
403 Forbidden 
사용자 기반 인증:
    :
auth_basic "    "
    :
Syntax: auth_basic string | off;
Default:    
auth_basic off;
Context:http, server, location, limit_except
auth_basic_user_file
    :
Syntax: auth_basic_user_file file;
Default:    —
Context:http, server, location, limit_except
    :
server {
        location /test1 {
        alias /mydata/html;
        auth_basic "test nginx";
        auth_basic_user_file /etc/nginx/conf.d/.npasswd;
    }
}
      :
[root@www21:28:47conf.d]#htpasswd -c -m /etc/nginx/conf.d/.npasswd tom
New password: 
Re-type new password: 
Adding password for user tom
  :
[root@www21:32:56~]#curl -u tom:123456 http://www.a.com/test1/
test alias for nginx
상태 정보 보기:
stub_status  on|off
    :
server {
    location /status {
        stub_status on;
        allow 172.20.23.33;
        deny all;
     }
}
      :
Active connections:    ,         
accepts:    ,              
handled:    ,                
requests:    ,            
Reading:    ,                     
Writing:    ,                    
Waiting:    ,                 접근 로그 형식 설정:
    :
log_format [log_name] '$1 $2 $3';
   http  
      :
access_log path [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]];
    :
       :
log_format test '$remote_addr:$remote_port $request_method $remote_user $status $http_user_agent $bytes_sent $gzip_ratio';  
       :
server {
    server {
    server_name www.a.com;
    listen 80;
    root /web/a.com;
    index index.html;
    server_tokens off;
    access_log /web/a.com/a.com.log test;
}
http         :
 $uri:     uri,    
 $host:http     host  ,       host  ,             
    !
 $request_uri:   uri,     
 $hostname:nginx            
 $remote_addr:   ip
 $remote_port:     
 $remote_user:                  
 $request_filename:      RUI    root alias              
 $request_method:    
 $server_addr:     
 $server_name:     
 $server_port:     
 $server_protocol:                 http/1.1
 $scheme:       scheme, https http,    
 $http_HEADER:          HEADER  $http_host        host  
 $sent_http_HEADER:          HEADER---   
    :$http_content_type        content-type  
 $document_root:        root   
      : 
 $status:       
 $bytes_sent:      
 $http_referer:          
 $http_user_agent:      
 $gzip_ratio:    ,      
로그 캐 시 설정:
open_log_file_cache max=N [inactive=time] [min_uses=N] [valid=time];  
open_log_file_cache off;  
                  
max:              
min_uses: inactive                        
inactive:       
valid:                     압축 기능:
    :
gzip on|off
    :
Syntax: gzip on | off;
Default:    
gzip off;
Context:http, server, location, if in location
     :
gzip_buffers [n]:       
gzip_comp_level[0--9]:    
gzip_distable [      ,     ]msie6
gzip_min_length [ ]:           
gzip_http_version:         ,       1.0/1.1
gzip_types:                   text/html
gzip_buffers number size;                          
  :32 4k   16 8k
gzip_vary on | off;      ,           “Vary: Accept-Encoding
    :
server {
        location /test3/ {
        gzip on;
        gzip_comp_level 6;
        gzip_min_length 100;
        gzip_types text/xml text/css text/plain application/javascript;
    }
}
  :
172.20.23.33:44018 GET - 200 curl/7.29.0  200 436946 "-" -->   
172.20.23.33:44020 GET - 200 curl/7.29.0  200 3252 "134.86"-->   이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
linux2에 nginx 설치설치 가능한 nginx를 확인하고, 해당 nginx를 설치한다. localhost 혹은 해당 ip로 접속을 하면 nginx 화면을 볼 수 있다....
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.