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?
nginx -q -c /home/worker/nginx/nginx.conf
?sudo
beforenginx...
command $ sudo nginx ...