【问题标题】:Local laravel web apps are not working properly after Ubuntu (and apache2) upgradeUbuntu(和 apache2)升级后本地 laravel Web 应用程序无法正常工作
【发布时间】:2014-04-30 21:44:03
【问题描述】:

从 13.10 升级到 Ubuntu 14.04 后,也安装了新版本的 apache2 (2.4.7)。我将所有本地 Web 应用程序从 var/www 移动到 var/www/html,这是 Ubuntu 14.04 上新的默认 apache2 文档根目录。

我的网络应用程序是用 Laravel 开发的,可以在不同的虚拟主机上运行,​​例如:example1.devexample2.dev。所以我还用正确的路径更改了他们配置文件中的DocumentRoot 指令。

我可以毫无问题地访问主页,但任何其他路由都会返回 404 错误。我需要改变什么来解决这个问题?

ps:在升级过程中,apache2.conf 文件被完全覆盖。

【问题讨论】:

  • 尝试通过 example.dev/index.php/route 访问您的路由。如果它有效,则您的 .htaccess 无法正常运行。确保启用 Apache 的 mod 重写模块。
  • 有效!但是当我运行a2enmod rewrite 时,它会返回Module rewrite already enabled

标签: apache ubuntu laravel laravel-4 apache2


【解决方案1】:

更新您的 DocRoot 后,您通常还需要在您的虚拟主机文件中更新此部分

<Directory "var/www/html/example.dev/public"> 
    Options +MultiViews 
    AllowOverride All 

    <IfVersion < 2.3 > 
        Order allow,deny 
        Allow from all 
    </IfVersion> 
    <IfVersion >= 2.3> 
        Require all granted 
    </IfVersion> 
</Directory>

(只是一个例子)

【讨论】:

    猜你喜欢
    • 2019-04-19
    • 1970-01-01
    • 2017-07-04
    • 2021-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-29
    相关资源
    最近更新 更多