【问题标题】:Nginx permission denied (for default user) on /var/log/nginx/var/log/nginx 上的 Nginx 权限被拒绝(对于默认用户)
【发布时间】:2017-11-03 14:59:06
【问题描述】:

我正在通过以下命令从源代码安装nginx

./configure --sbin-path=/usr/bin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-debug --with-pcre \
    --with-http_ssl_module \
    && make \
    && make install

/etc/nginx/nginx.conf 中的 user 条目被注释掉:

#user  nobody;

当尝试通过命令行启动 nginx 时,只需键入 nginx 我收到以下错误:

nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
2017/11/03 14:57:08 [emerg] 17427#0: mkdir() "/usr/local/nginx/client_body_temp" failed (13: Permission denied)

我假设第二个错误与在/usr/local/nginx 下创建.pid 文件的过程有关...(?)

/etc/passwd 中没有nginx 用户。

  1. nginx 进程以哪个用户身份启动?
  2. 通过源代码安装后,是否需要手动更改/var/log 下的权限/所有权?

nginx 1.13.6 一起处理debian jessie

【问题讨论】:

    标签: nginx logging permissions debian nginx-location


    【解决方案1】:

    我在执行命令nginx -t 时遇到了同样的错误。我用sudo nginx -t解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-15
      • 2019-06-16
      • 2020-08-25
      • 2021-03-27
      • 2017-11-03
      • 1970-01-01
      • 2022-01-23
      • 2020-02-08
      相关资源
      最近更新 更多