2012-10-22 66 views
4

我目前想在我的Rails安装程序中使用NGINX。我已将配置文件放置在目录RAILS_ROOT/config/nginx中。这是我的配置文件,名为development.confmime.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 

我做错了什么?

回答

7

http://nginx.org/en/docs/ngx_core_module.html#error_log表示:

  1. 的默认值是error_log logs/error.log error;
  2. ,对于调试日志记录工作,nginx的需要用--with-debug.`

发生了什么建是你正在跌落到默认值,我没有发现任何语法错误,所以我的猜测是你的nginx不是用--with-debug编译的。

可以检查与nginx -V(注:这是资本V)

+0

你如何用debug进行编译?你需要再次卸载/重新安装nginx吗? – octohedron

7

MAC它是在

/usr/local/logs/error.log 

,我发现这个运行后:

nginx -V 

配置参数:--prefix =/usr/local --with-cc-opt = -Wno-deprecated-declarations --wit h-http_ssl_module --add-module = ../nginx-rtmp-module/

相关问题