ubuntu - Nginx:Ubuntu 上的 nginx 权限被拒绝

标签 ubuntu nginx debian vagrant puppet

<分区>


这个问题似乎不是关于 a specific programming problem, a software algorithm, or software tools primarily used by programmers 的.如果您认为这个问题是关于 another Stack Exchange site 的主题,您可以发表评论,说明问题可能在哪里得到解答。

关闭 1 年前

社区在1 年前 审查了是否重新打开此问题,然后将其关闭:

原始关闭原因未解决

我是系统管理新手。安装nginx后via puppet在 Ubuntu 上我得到以下输出:

[alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)

[warn] 1898#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1

[emerg] 1898#0: open() "/var/log/nginx/access.log" failed (13: Permission denied)

如何删除所有这些消息?

我不想直接使用命令行 (chown/chmod) 并在每次创建新服务器时重复它。因此,我在考虑必须添加到 puppet list 中的内容。

在这种情况下,最好的系统管理员实践是什么:更改/var/log/nginx 的所有者/权限或将日志存储在不同的位置?如果 chown/chmod 是要走的路,哪些特定权限可以确保最高级别的安全性?

我试过了,但没用:

  file { '/var/log/nginx':
    ensure  => directory,
    mode    => '0755',
    owner   => 'www-data',
    group   => 'www-data',
    recurse => true
  }

编辑:

vagrant@precise64:~$ ps aux | grep [n]ginx
root      1001  0.0  0.1  62908  1388 ?        Ss   08:47   0:00 nginx: master process /usr/sbin/nginx
www-data  1002  0.0  0.1  63260  1696 ?        S    08:47   0:00 nginx: worker process
www-data  1003  0.0  0.1  63260  1696 ?        S    08:47   0:00 nginx: worker process
www-data  1004  0.0  0.1  63260  1696 ?        S    08:47   0:00 nginx: worker process
www-data  1005  0.0  0.1  63260  1696 ?        S    08:47   0:00 nginx: worker process

最佳答案

确保您以 super 用户身份运行测试。

sudo nginx -t

或者测试不具备正确完成测试所需的所有权限。

关于ubuntu - Nginx:Ubuntu 上的 nginx 权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18714902/

上一篇:ubuntu - 如何在 VM box 上升级到 VirtualBox Guest Additions?

下一篇:ubuntu - "Host key verification failed"时如何建立ssh key 对

相关文章:

debian - GitLab:如何禁用自动启动?

python - 如何在 LibreOffice 中运行 python 宏?

python - 使用 gitbash 终端将文件从 Windows 10 移动到 ubuntu 文件夹

apache - .htaccess RewriteCond %{REQUEST_FILENAME}

php - 如何在 Ubuntu 上安装这些 PHP 扩展?

python - 如何在nginx中生成用户定义的 "404 page not found"?

ssl - 在 debian stretch 上启动 upwork 应用程序时出现未知 SSL 错误 -12218 (SSL_ENCRYPTION_FAILURE)

linux - Linux Shell 脚本的奇怪行为

google-chrome - 如何强制 chrome 为 webgl 使用 mesa 软件驱动程序

java - 如何以编程方式禁用覆盖滚动条 (Ubuntu Java)