0

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)

As you can see in the nginx.conf, I have defined error_log, but I still got the warning message:

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, how can I do that?

  • Hmm. I misread this at first. I suspect somebody else did too. Are you sure that is your entire nginx configuration? – Michael Hampton May 14 at 4:04
  • @MichaelHampton Sorry for my bad English. Thank you for your time, yes. this is the minimal conf file that can produce the issue. – gacopu May 14 at 4:09
  • Have you tried: nginx -q -c /home/worker/nginx/nginx.conf? – Richard Smith May 14 at 6:33
  • @RichardSmith Just tried, no change. – gacopu May 14 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.