【发布时间】:2013-09-13 22:13:28
【问题描述】:
我是系统管理新手。在 Ubuntu 上安装 nginx via 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 manifest 中添加什么。
在这种情况下,最佳系统管理员做法是什么:更改 /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 非主进程? -
检查一次已经运行的端口,如果nginx端口
443或80如果被其他进程使用,可能会导致类似的错误。使用命令sudo netstat -tulpn检查端口80或443是否被其他进程使用。
标签: ubuntu nginx debian vagrant puppet