【问题标题】:Laravel 4.2 + nginx 404 File not foundLaravel 4.2 + nginx 404 找不到文件
【发布时间】:2016-10-25 09:49:39
【问题描述】:

为什么显示错误?

我在 laravel 5.2 上运行其他 laravel 项目很好,但我有 laravel 4.2 的旧项目,但出现此错误:

404 File Not Found

您可以检查错误here

在我的本地电脑上,使用 Laravel Valet 运行良好的 php7 fpm。

这是我的 nginx 配置文件:

server {
        listen  80;
        server_name blog.yourserviceconnection.com;
        root var/www/html/blog/public/;
        index index.php index.html index.htm;

        location / {
            try_files $uri $uri/ /index.php;
        }
        location ~ \.(hh|php)$ {
                fastcgi_keep_conn on;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}

在我看来一切都很好,这是 .htaccess 文件:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    Options +FollowSymLinks
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

【问题讨论】:

    标签: php laravel nginx laravel-4


    【解决方案1】:

    我看到你使用的是 hhvm 所以而不是添加。

    location ~ \.(hh|php)$ {
                    fastcgi_keep_conn on;
                    fastcgi_pass 127.0.0.1:9000;
                    fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
            }
    

    使用

    include hhvm.conf
    

    这可能会有所帮助,因为它是 hhvm 的默认配置,所以不会出错。

    【讨论】:

      猜你喜欢
      • 2021-06-22
      • 1970-01-01
      • 1970-01-01
      • 2013-08-28
      • 1970-01-01
      • 2018-11-06
      • 2015-08-18
      • 2016-09-24
      • 2016-02-18
      相关资源
      最近更新 更多