为什么NGINX想要使用./logs/error.log作为默认值?

Kas*_*bbe 4 nginx osx-lion

我目前想在我的Rails设置中使用NGINX.我已将配置文件放在目录中RAILS_ROOT/config/nginx.这是我的配置文件放置命名development.confmime.types-file.

我想将我的日志放在RAILS_ROOT/log-directory中.

这是我的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;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我使用此命令从我的RAILS_ROOT启动NGINX:

nginx -p . -c config/nginx/development.conf
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

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

我的版本是这样的:

[(master)]=> nginx -v
nginx version: nginx/1.2.4
Run Code Online (Sandbox Code Playgroud)

我做错了吗?

cob*_*aco 9

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)


use*_*754 9

MAC它是在

/usr/local/logs/error.log 
Run Code Online (Sandbox Code Playgroud)

我跑完后发现了这个:

nginx -V 
Run Code Online (Sandbox Code Playgroud)

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