Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nginx在Ubuntu上返回404?_Ubuntu_Nginx - Fatal编程技术网

Nginx在Ubuntu上返回404?

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

我决定将我的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服务后重新启动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.conf
user nginx配置了哪个用户是默认值?目录
developer
正在阻止对其下任何目录的访问。看看权限。