nginx 로그 문제 해결 방법 기록
                                            
 16992 단어  nginxlogLAMP 와 LNMP
                    
#
nginx -V
nginx version: nginx/1.2.0 최신 안정 버 전
built by gcc 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-ath=/var/log/nginx/ng
inx.pid --lock-path=/var/lock/nginx.lock --user=www --group=www --with-http_ssl_module --with-ttp_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_stub_status_module --with-google_perftools_module --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi --http-client-body-temp-path=/var/tmp/nginx/client --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
nginx 설정 은 다음 과 같 습 니 다.
   
   
   
   
    
    
    
    - user  www; 
- worker_processes  2; 
- google_perftools_profiles /var/tmp/nginx/tcmalloc/tcmalloc; 
- events { 
-     use epoll; 
-     worker_connections  51000; 
-         } 
- http 
- { 
-     include       mime.types; 
-     default_type  application/octet-stream; 
-     keepalive_timeout     65; 
-     sendfile              on; 
-     tcp_nopush            on; 
-     tcp_nodelay           on; 
-     client_header_timeout 10; 
-     client_body_timeout   10; 
-     send_timeout          10; 
-     gzip  on; 
-     gzip_min_length       1k; 
-     gzip_buffers       4 16k; 
-     gzip_http_version    1.1; 
-     gzip_comp_level        2; 
-     gzip_types  text/plain application/x-javascript text/css applocation/xml; 
-     server { 
-         listen       80; 
-         server_name  localhost; 
-         location / { 
-             root   html; 
-             index  index.html index.htm; 
-                     } 
-         error_page   500 502 503 504  /50x.html; 
-         location = /50x.html { 
-             root   html; 
-                               } 
-         location ~ \.php$ { 
-             root           html; 
-             fastcgi_pass   127.0.0.1:9000; 
-             fastcgi_index  index.php; 
-             fastcgi_param  SCRIPT_FILENAME  /usr/html$fastcgi_script_name; 
-             include        fastcgi_params; 
-                             }        
-     log_format  welog  '$remote_addr - $remote_user [$time_local] "$request" ' 
-                        '$status $body_bytes_sent "$http_referer" ' 
-                        '"$http_user_agent" "$http_x_forwarded_for"'; 
-      access_log  /var/log/nginx/access.log  weblog; 
-               } 
-  } 
   
   
   
   
    
    
    
    -   nginx   ,      
- #service nginx restart 
- nginx: [warn] the "log_format" directive may be used only on "http" level in /etc/nginx/nginx.conf:97 
- nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
- nginx: configuration file /etc/nginx/nginx.conf test is successful 
- Stopping nginx:                                            [  OK  ] 
- Starting nginx: nginx: [warn] the "log_format" directive may be used only on "http" level in /etc/nginx/nginx.conf:97 
-                                                            [  OK  ] 
-               http ,         
수 정 된 nginx. conf 파일 은 다음 과 같 습 니 다.
   
   
   
   
    
    
    
    - user  www;  
- worker_processes  2;  
- google_perftools_profiles /var/tmp/nginx/tcmalloc/tcmalloc;  
- events {  
-     use epoll;  
-     worker_connections  51000;  
-         }  
- http  
- {  
-     include       mime.types;  
-     default_type  application/octet-stream;  
-     keepalive_timeout     65;  
-     sendfile              on;  
-     tcp_nopush            on;  
-     tcp_nodelay           on;  
-     client_header_timeout 10;  
-     client_body_timeout   10;  
-     send_timeout          10;  
-     gzip  on;  
-     gzip_min_length       1k;  
-     gzip_buffers       4 16k;  
-     gzip_http_version    1.1;  
-     gzip_comp_level        2;  
-     gzip_types  text/plain application/x-javascript text/css applocation/xml;  
-     server {  
-         listen       80;  
-         server_name  localhost;  
-         location / {  
-             root   html;  
-             index  index.html index.htm;  
-                     }  
-         error_page   500 502 503 504  /50x.html;  
-         location = /50x.html {  
-             root   html;  
-                               }  
-         location ~ \.php$ {  
-             root           html;  
-             fastcgi_pass   127.0.0.1:9000;  
-             fastcgi_index  index.php;  
-             fastcgi_param  SCRIPT_FILENAME  /usr/html$fastcgi_script_name;  
-             include        fastcgi_params;  
-                             } 
-              }      ,        server   ,                
-     log_format  welog  '$remote_addr - $remote_user [$time_local] "$request" '  
-                        '$status $body_bytes_sent "$http_referer" '  
-                        '"$http_user_agent" "$http_x_forwarded_for"';  
-      access_log  /var/log/nginx/access.log  weblog;  
-                 
-  }  
nginx 서 비 스 를 다시 시작 하면 OK,
   
   
   
   
    
    
    
    - service nginx restart      
- nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 
- nginx: configuration file /etc/nginx/nginx.conf test is successful 
- Stopping nginx:                                            [  OK  ] 
- Starting nginx:                                            [  OK  ] 
서버 에서 로 그 를 정의 해 야 한다 면 어떻게 해 야 합 니까? 다음 과 같 습 니 다.
   
   
   
   
    
    
    
    - user  www;   
- worker_processes  2;   
- google_perftools_profiles /var/tmp/nginx/tcmalloc/tcmalloc;   
- events {   
-     use epoll;   
-     worker_connections  51000;   
-         }   
- http   
- {   
-     include       mime.types;   
-     default_type  application/octet-stream;   
-     keepalive_timeout     65;   
-     sendfile              on;   
-     tcp_nopush            on;   
-     tcp_nodelay           on;   
-     client_header_timeout 10;   
-     client_body_timeout   10;   
-     send_timeout          10;   
-     gzip  on;   
-     gzip_min_length       1k;   
-     gzip_buffers       4 16k;   
-     gzip_http_version    1.1;   
-     gzip_comp_level        2;   
-     gzip_types  text/plain application/x-javascript text/css applocation/xml;   
-     server {   
-         listen       80;   
-         server_name  localhost;   
-         location / {   
-             root   html;   
-             index  index.html index.htm;   
-                     }   
-         error_page   500 502 503 504  /50x.html;   
-         location = /50x.html {   
-             root   html;   
-                               }   
-         location ~ \.php$ {   
-             root           html;   
-             fastcgi_pass   127.0.0.1:9000;   
-             fastcgi_index  index.php;   
-             fastcgi_param  SCRIPT_FILENAME  /usr/html$fastcgi_script_name;   
-             include        fastcgi_params;
-                            }   
-             access_log  /var/log/nginx/access2.log;           ,                           
-            }      ,        server   ,                 
-      log_format  welog  '$remote_addr - $remote_user [$time_local] "$request" '   
-                         '$status $body_bytes_sent "$http_referer" '   
-                         '"$http_user_agent" "$http_x_forwarded_for"';   
-      access_log  /var/log/nginx/access.log  weblog;   
-                  
-  }  
더 많은 nginx 로그 문 제 는 nginx 의 wiki 를 참고 하 십시오.
http://wiki.nginx.org/HttpLogModule
결국 문 제 를 해결 하 는 것 은 이 url 입 니 다.
http://thread.gmane.org/gmane.comp.web.nginx.english/9277
itnihao 2012 년 5 월 3 일 청 두에 서
전 재 는 상기 정 보 를 명시 해 주 십시오.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
간단! Certbot을 사용하여 웹 사이트를 SSL(HTTPS)화하는 방법초보자가 인프라 주위를 정돈하는 것은 매우 어렵습니다. 이번은 사이트를 간단하게 SSL화(HTTP에서 HTTPS통신)로 변경하는 방법을 소개합니다! 이번에는 소프트웨어 시스템 Nginx CentOS7 의 환경에서 S...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.