user5405648
user5405648

Reputation:

Nginx returning 404 on Ubuntu?

I decided to change my nginx sites root to a different location, outside of the nginx directory (etc/nginx) but now it seems to have broken something, and I think its the permissions?

Somebody told me you cannot have an nginx site outside its nginx directory but I don't think this is true, as it doesn't make much sense, but here is the logs and commands I've tried.

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$

I've tried these commands, none work.

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

Restarting the nginx service after running each one.

404 Not Found nginx/1.15.5 (Ubuntu)

Running namei -om /media/developer/megasync/workspace/coding/projects/websites returns

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 file:

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;
        }
}

Upvotes: 0

Views: 545

Answers (1)

user5405648
user5405648

Reputation:

Run namei -om /media/developer/megasync/workspace/coding/projects/websites and you'll see that the developer is blocking permissions to any child directorys

Upvotes: 0

Related Questions