无论配置如何,nginx都会尝试打开默认的error.log

时间:2016-01-10 10:59:54

标签: linux nginx

我有~/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;
    }
  }
}

0 个答案:

没有答案