vendredi 14 juin 2019

All routes returning 404 except '/'

I have successfully installed a laravel application on a nginx server running on arch linux. However when I try to view the app in web browser all routes return 404 except the default '/'. I know this because I have make:auth but I can't reach the register and login page.

I followed instructions I found via Google and created two folders, sites-available and sites enabled in /etc/nginx/. I then created a config file for laravel app in /etc/nginx/sites-available called niko in sites available and symlinked to it like so ln --symbolic /etc/nginx/sites-available/niko /etc/nginx/sites-enabled/niko.

Here are the contents of my configuration file /etc/nginx/sites-available/niko.

server {
    listen       80;
    server_name  niko;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   /usr/share/nginx/html/niko/public;
        index  index.html index.htm index.php;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location ~ \.php$ {
            fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
            fastcgi_index index.php;
            root /usr/share/nginx/html/niko/public;
            include fastcgi.conf;
    }
    }

In my /etc/nginx/nginx.conf I have this line just above the closing } of the http {} block:
include /etc/nginx/sites-enabled/*; When I check in the nginx error log(/var/log/nginx/error.log) I find this entries:

2019/06/14 10:59:22 [error] 5429#5429: *3 directory index of "/usr/share/nginx/html/niko/" is forbidden, client: 192.168.1.101, server>
2019/06/14 10:59:36 [error] 5429#5429: *3 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 10:59:36 [error] 5429#5429: *3 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 10:59:38 [error] 5429#5429: *3 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 10:59:38 [error] 5429#5429: *3 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 11:26:53 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 11:26:53 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/public/login" failed (2: No such file or directory), clie>
2019/06/14 11:27:01 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/index.php/login" failed (2: No such file or directory), c>
2019/06/14 11:27:01 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/index.php/login" failed (2: No such file or directory), c>
2019/06/14 11:27:04 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/index.php/login" failed (2: No such file or directory), c>
2019/06/14 11:27:04 [error] 5429#5429: *7 open() "/usr/share/nginx/html/niko/index.php/login" failed (2: No such file or directory), 

I have been pulling out my hair for hours because I don't know where to check. I have tried several things but nothing seems to work. Your support is appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire