所有Laravel路由都在nginx子目录中提供404

时间:2016-08-01 17:50:05

标签: nginx laravel-5 laravel-5.1 subdirectory

我的nginx配置有问题。我想在子目录中使用Laravel应用程序,完全是domain.com/alfa。在domain.com是另一个应用程序。现在所有的Laravel路由都在nginx子目录中提供了404。有人可以帮忙找错吗?

我的路径:

  • / var / www /< - 适用于domain.com
  • / var / www / alfa_path< - 适用于domain.com/alfa

这是我的nginx配置:

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

0 个答案:

没有答案