lundi 1 août 2016

All Laravel routes gives 404 on nginx subdirectory

I have problem with nginx configuration. I wanna have Laravel app in subdirectory, exactly domain.com/alfa. At domain.com is another app. And now all Laravel routes gives 404 on nginx subdirectory. Could someone help you find an error?

My paths:

  • /var/www/ <-- it's for domain.com
  • /var/www/alfa_path <-- it's for domain.com/alfa

It's my nginx configuration:

server
{
        listen 80;
        server_name domain.com;

        root /var/www;
        index index.php index.html index.htm;

        location / {
        }

        location /alfa {
                root /var/www/alfa_path/public;
                index index.php index.html index.htm;
                try_files $uri $uri/ /alfa_path/public/index.php?$query_string;
        }

        location ~ .php$ {
                try_files $uri =404;
                fastcgi_pass unix:/var/run/www.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include /etc/nginx/fastcgi_params;
        }

        location /phpmyadmin {
                root /usr/share/;
                index index.php index.html index.htm;
                location ~ ^/phpmyadmin/(.+\.php)$ {
                        try_files $uri =404;
                        root /usr/share/;
                        fastcgi_pass unix:/var/run/www.sock;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include /etc/nginx/fastcgi_params;
                }
                location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                        root /usr/share/;
                }
        }

        location /phpMyAdmin {
                rewrite ^/* /phpmyadmin last;
        }
}

laravel 404



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire