2012-10-22 5 views
4

현재 Rails 설정에서 NGINX를 사용하고 싶습니다. 구성 파일을 RAILS_ROOT/config/nginx 디렉토리에 저장했습니다. 여기에 내 config- 파일의 이름은 development.conf이고 mime.types- 파일입니다.NGINX가 ./logs/error.log를 기본값으로 사용하려는 이유는 무엇입니까?

내 로그를 RAILS_ROOT/log - 디렉토리에 넣으려고합니다.

은 내 development.conf :

worker_processes 1; 

events { 
    worker_connections 1024; 
} 

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

    # main access log 
    access_log log/nginx.access.log; 

    # main error log 
    error_log log/nginx.error.log debug; 

    sendfile  on; 

    keepalive_timeout 65; 

    server { 
    listen 9001; #omg! 
    server_name local.woman.dk; 

    rewrite ^/(.*)/$ /$1 last; 

    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header Host $http_host; 
    proxy_redirect off; 
    proxy_max_temp_file_size 0; 

    location/{ 
     ssi on; 
     proxy_pass http://127.0.0.1:3000; 
    } 
    } 
} 

내가이 명령을 내 RAILS_ROOT에서의 nginx를 시작하고있다 :

nginx -p . -c config/nginx/development.conf 

그리고 다음과 같은 오류 얻을 :

nginx: [alert] could not open error log file: open() "./logs/error.log" failed (2: No such file or directory) 

내 버전 이 :

[(master)]=> nginx -v 
nginx version: nginx/1.2.4 

뭐가 잘못 되었나요?

  1. 기본값은 디버그 로깅이 작동하려면, nginx를가 무슨 일이야

--with-debug.`로 구축 될 필요가 있다고 error_log logs/error.log error;

  • 입니다 :

  • 답변

    7

    http://nginx.org/en/docs/ngx_core_module.html#error_log는 것을 나타냅니다 당신이 기본값을 빠져 나가는 것입니다, 나는 내 생각 엔 당신의 nginx가 --with-debug로 컴파일되지 않았기 때문에 문법 오류를 발견하지 못한다.

    nginx -V로 그를 확인할 수 있습니다

    nginx -V 
    

    구성을 : 그것은 실행 한 후

    /usr/local/logs/error.log 
    

    내가이 발견

    이었다 에 MAC을 (주 그건 자본 V)

    +0

    그리고 디버그로 어떻게 컴파일합니까? nginx를 다시 설치/재설치해야합니까? – octohedron

    7

    을 인수 : --prefix =/usr/local --with-cc-opt = -When-deprecated-declarations --wit h-http_ssl_module --add-module = ../nginx-rtmp-module/

    관련 문제