我是新手系统管理员。在Ubuntu上安装nginx 通过puppet之后,我得到了以下输出:
[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清单中添加什么。
在这种情况下,最好的系统管理员实践是要更改/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
vagrant provision
)?/etc/nginx/nginx.conf
使用www-data
还是nginx
来运行非主进程的 nginx? - Terry Wang443
或80
如果它们被其他进程使用,则可能会导致类似的错误。使用命令sudo netstat -tulpn
检查端口 80 或 443 是否被其他进程使用。 - Akhil S