问题描述
我是系统管理的新手.在Ubuntu上通过puppet安装nginx 通过之后,我得到以下输出:
I am new to system administration. After installing nginx via puppet on Ubuntu I get the following output:
[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)
如何清除所有这些消息?
How do I get rid of all of these messages?
我不想直接使用命令行(chown/chmod)并在每次创建新服务器时重复使用它.因此,我正在考虑将哪些内容添加到木偶清单中.
I don't want to use command line directly (chown / chmod) and repeat it every time I create a new server. Therefore, I am thinking of what has to be added to the puppet manifest.
在这种情况下,最佳的sysadmin做法是什么:更改/var/log/nginx的所有者/权限或将日志存储在其他位置?如果要使用chown/chmod,哪种特定权限可以确保最高级别的安全性?
What is the best sysadmin practice in this case: to change owner / permissions for /var/log/nginx or to store logs in different location? If chown / chmod is the way to go, which specific permissions would ensure the highest level of security?
我尝试了这个,但是没有帮助:
I tried this, but it didn't help:
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
推荐答案
确保您以超级用户身份运行测试.
Make sure you are running the test as a superuser.
sudo nginx -t
否则,测试将没有正确完成测试所需的所有权限.
Or the test wont have all the permissions needed to complete the test properly.
这篇关于Nginx:Ubuntu上对Nginx的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!