我遇到了nginx权限问题,我做了一些研究,但我尝试过的解决方案都没有。
以下是我尝试过的错误。
我过去曾多次安装过nginx,所以我不确定为什么会出现这么多问题。它可能是操作系统吗?
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chmod +x /home/
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chown -R root:www-data /home/yessir/cache
chown: invalid group: `root:www-data'
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chown -R root:www-data /home/yessir/
chown: invalid group: `root:www-data'
[root@localhost ~]# chown -R root:nginx /home/yessir/
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chown -R root:nginx /home/yessir/cache
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chmod g+w -R /home/yessir/
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chmod g+w -R /home/yessir/cache
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# chmod g+w -R^C
[root@localhost ~]# sudo -u nginx stat /home/yessir/
File: `/home/yessir/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 45088770 Links: 4
Access: (0777/drwxrwxrwx) Uid: ( 0/ root) Gid: ( 498/ nginx)
Access: 2016-02-09 10:27:05.438388374 -0800
Modify: 2016-02-09 10:08:15.818386811 -0800
Change: 2016-02-09 10:27:05.438388374 -0800
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
[FAILED]
[root@localhost ~]# sudo -u nginx stat /home/yessir/cahce
stat: cannot stat `/home/yessir/cahce': No such file or directory
[root@localhost ~]# sudo -u nginx stat /home/yessir/cache
File: `/home/yessir/cache'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 802h/2050d Inode: 45088772 Links: 2
Access: (0777/drwxrwxrwx) Uid: ( 0/ root) Gid: ( 498/ nginx)
Access: 2016-02-09 10:27:08.557388846 -0800
Modify: 2016-02-09 10:08:15.818386811 -0800
Change: 2016-02-09 10:27:08.557388846 -0800
[root@localhost ~]# service nginx start
Starting nginx: nginx: [emerg] chown("/home/yessir/cache", 498) failed (13: Permission denied)
答案 0 :(得分:0)
错误消息未指示拒绝/ access /目录的权限,错误消息表明权限被拒绝/ chown /目录。
这很奇怪,因为chown
通常只以root身份运行,但Nginx通常以www-data
用户身份运行。
当此错误出现之前,答案结果为target directory had been mounted remotely (or in a virtual machine?) and the mount settings weren't quite right。是机会,是/ home / yessir / cache是远程托管还是虚拟机托管?