Why NGINX wants to use. /logs/error.log by default?

Currently I want to use NGINX in my Rails setup. I placed the configuration files in the RAILS_ROOT/config/nginx directory. Here is my configuration file called development.conf and mime.types -file.

I want to place my logs in the RAILS_ROOT/log directory.

This is my 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; } } } 

I start NGINX from my RAILS_ROOT with this command:

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

And I get the following error:

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

My version is this:

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

Am I doing something wrong?

+4
source share
2 answers

http://nginx.org/en/docs/ngx_core_module.html#error_log indicates that:

  • the default value is error_log logs/error.log error;
  • that to debug logging nginx needs to be built with --with-debug.`

what happens is that you fall into the default value, I do not detect any syntax errors, so I assume that your nginx is not compiled with -with-debug.

you can check this with nginx -V (note: this capital is V)

+8
source

At MAC, he was in

 /usr/local/logs/error.log 

I found this after starting:

 nginx -V 

configure arguments: - prefix = / usr / local --with-cc-opt = -Wno-deprecated-declarations --with-http_ssl_module --add-module = .. / nginx -rtmp-module /

+8
source

Source: https://habr.com/ru/post/1441268/


All Articles