I have a ~/nginx.conf
with error_log /home/user/error.log
(also in http section), and it works smoothly with sudo nginx -c ~/nginx.conf
.
But without sudo
I get [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
, though nginx seems to work.
What is the cause and how to get rid of it?
UPD: used config
worker_processes 4;
pid /home/user/nginx.pid;
error_log /home/user/error.log;
events {
worker_connections 768;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /home/user/access.log;
error_log /home/user/httperror.log;
server {
listen 8080 default_server;
root /home/user/static;
index index.html;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
}
}