小编use*_*927的帖子

在nginx之后找不到Laravel路线

在我将ICG更改为nginx之后,除索引页之外的所有路由都不起作用.

Laravel配置:

#/etc/nginx/sites-enabled/laravel
server {
    listen 80;

    root /var/www/home;
    index index.php;

    server_name 192.168.178.71;

    access_log /var/www/home/storage/app/logs/laravel-nginx-access.log;
    error_log  /var/www/home/storage/app/logs/laravel-nginx-error.log error;


    location /home {
        root /home/public;
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }


    # ERROR
    error_page 404 /index.php;


    # DENY HTACCESS
    location ~ /\.ht {
        deny all;
    }
}
Run Code Online (Sandbox Code Playgroud)

默认配置:

# /etc/nginx/sites-enabled/default
server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www;

        # Add index.php to the …
Run Code Online (Sandbox Code Playgroud)

php apache fastcgi nginx laravel

19
推荐指数
4
解决办法
2万
查看次数

标签 统计

apache ×1

fastcgi ×1

laravel ×1

nginx ×1

php ×1