Nginx在Ubuntu上返回404?
我决定将我的nginx站点根目录更改为nginx目录之外的其他位置(Nginx在Ubuntu上返回404?,ubuntu,nginx,Ubuntu,Nginx,我决定将我的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/develop
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服务后重新启动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
配置文件:
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;
}
}
运行
namei-om/media/developer/megasync/workspace/coding/projects/websites
,您将看到developer
正在阻止对任何子目录的权限运行namei-om/media/developer/megasync/workspace/coding/projects/websites
,您将看到开发人员正在阻止任何子目录的权限您为nginx.conf用户nginx配置了哪个用户代码>是默认值?目录developer
正在阻止对其下任何目录的访问。查看权限。您为nginx.confuser nginx配置了哪个用户代码>是默认值?目录developer
正在阻止对其下任何目录的访问。看看权限。