我决定将我的nginx网站根目录更改为nginx目录(etc/nginx
之外的其他位置,但现在看来它已经损坏了一些东西,我认为它的权限是什么?
有人告诉我,您不能在其nginx目录之外拥有一个nginx站点,但是我认为这是不对的,因为这没有多大意义,但这是我尝试过的日志和命令。
Checked my error log and it seems to be returning this:
2019/03/25 22:53:25 [crit] 2107#2107: *1 stat() "/media/developer/megasync/workspace/coding/projects/websites/codeshare/public/" failed (13: Permission denied), cli$
2019/03/25 22:55:40 [crit] 2329#2329: *1 stat() "/media/developer/megasync/workspace/coding/projects/websites/codeshare/public/" failed (13: Permission denied), cli$
我尝试了这些命令,没有用。
sudo chown -R www-data /media/developer/megasync/workspace/coding/projects/websites
sudo chown -R www-data:www-data /media/developer/megasync/workspace/coding/projects/websites
sudo chown -R developer:www-data /media/developer/megasync/workspace/coding/projects/websites
运行每一项后重新启动nginx服务。
404找不到 nginx / 1.15.5(Ubuntu)
运行namei -om /media/developer/megasync/workspace/coding/projects/websites
返回
drwxr-xr-x root root /
drwxr-xr-x root root media
drwxr-x--- root root developer
drwxrwxrwx developer developer megasync
drwxrwxrwx developer developer workspace
drwxrwxrwx developer developer coding
drwxrwxrwx developer developer projects
drwxrwxrwx developer developer websites
conf文件:
server {
listen 80;
root /media/developer/megasync/workspace/coding/projects/websites/codeshare.io/public;
index index.php index.html index.htm;
server_name landing.io;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
答案 0 :(得分:2)
运行namei -om /media/developer/megasync/workspace/coding/projects/websites
,您会看到developer
阻止了对任何子目录的访问权限