Ubuntu上的nginx:权限被拒绝 [英] nginx on Ubuntu: Permission denied

查看:1425
本文介绍了Ubuntu上的nginx:权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是系统管理的新手。在Ubuntu上安装nginx 通过木偶后,我得到以下输出:

  [alert]无法打开错误日志文件:open()/var/log/nginx/error.logfailed(13:Permission denied)

[warn] 1898#0:只有主进程以超级用户权限运行,user指令才有意义,在/etc/nginx/nginx.conf中被忽略

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

我如何摆脱所有这些消息?



我不想直接使用命令行(chown / chmod )并在每次创建新服务器时重复此操作。因此,我正在考虑要添加到木偶表单中的内容。



在这种情况下,最好的系统管理员练习是什么:更改/ var /日志/ nginx或将日志存储在不同的位置?如果chown / chmod是要走的路,哪些具体的权限会确保最高的安全级别?



我试过这个,但没有帮助:

  file {'/ var / log / nginx':
ensure =>目录,
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:主进程/ 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


解决方案

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

  sudo nginx -t 

或者测试没有正确完成测试所需的所有权限。


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?

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.

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
  }

Edited:

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.

这篇关于Ubuntu上的nginx:权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆