我有~/nginx.conf
error_log /home/user/error.log
(也在http部分),它与sudo nginx -c ~/nginx.conf
一起顺利运作。
但是没有sudo
我得到[alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
,虽然nginx似乎有效。
是什么原因以及如何摆脱它?
UPD: 使用了配置
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;
}
}
}