How to dismiss nginx warning message nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

gacopu asked:

I’m running nginx using common user not root. I have nginx installed system-wide, but have nginx.conf in HOME.

$HOME/nginx/nginx.conf

worker_processes  1;
error_log  /home/worker/nginx/log/nginx/error.log warn;
pid        /home/worker/nginx/run/nginx.pid;
events {
  worker_connections  1024;
}
http {
  include      /etc/nginx/mime.types;
  default_type application/octet-stream;
  access_log   /home/worker/nginx/log/nginx/access.log;
  server {
    listen 8080;
    root /home/worker/nginx/data;
  }
}

start nginx

$ nginx -c /home/worker/nginx/nginx.conf
nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

nginx itself works, just want to remove this warning message?

My answer:


Set the error_log to some path that is writable by nginx.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.