升级到 Ubuntu 13.10 后,laravel 项目在 Apache 上出现 403 错误 [英] 403 error on Apache for a laravel project, after upgrade to Ubuntu 13.10

查看:21
本文介绍了升级到 Ubuntu 13.10 后,laravel 项目在 Apache 上出现 403 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我升级到 Ubuntu 13.10.起初在更新后运行apache时,文件丢失/损坏,所以我只是重新安装了apache.我备份了 vhost 文件.

尝试从浏览器访问我的 Laravel 项目时,出现 403 错误.我已经多次更改根文件夹的权限,但仍然被禁止.我不相信这是 Laravel 的问题,因为我已经在 13.04 上修复了它,而且我正在使用相同的文件.

这是我的 000-default.conf 文件,位于/sites-enabled 和/sites-available.我的 apache2.conf 文件自安装以来没有改变.

DocumentRoot/home/brennan/development/MasonACM/public<目录/>选项 FollowSymLinks允许覆盖无</目录><目录/home/brennan/development/MasonACM/public/>选项索引 FollowSymLinks MultiViews允许覆盖所有命令允许,拒绝允许所有人</目录>ErrorLog/var/log/apache2/error.log日志级别警告CustomLog/var/log/apache2/access.log 合并</虚拟主机>

还应该注意的是,我的 .htaccess 文件没有丢失,并且自该站点在 13.04 上运行后就没有更改过.

更新:

我现在可以使用 apache 的主机设置,但是现在浏览器正在显示 index.php 的实际代码,这意味着 apache 由于某种原因没有使用 php.我刚检查了php安装好了,为什么apache不能识别呢?

解决方案

Apache2可能也升级到了2.4版本,有几点需要注意.

首先,您现在有 Apache 2.4.x+ 吗?通过运行检查:

$ apache2 -v

如果是这样,您的虚拟主机需要进行一些调整:

第一个:+/- 选项:

某些 Options 参数需要 +/- 语法.在此处阅读更多信息.在某些指令上混合使用 +/- 时,这可能尤其重要(阅读上一个链接以了解更多信息).

变化:

Options Indexes FollowSymLinks MultiViews

到:

Options +Indexes +FollowSymLinks +MultiViews

第二:允许/拒绝

Apache 现在通过 mod_authz_host

进行访问控制

变化:

订单允许,拒绝所有人都允许

到:

要求所有授予

这里有关于从 Apache 2.2 升级到 2.4 的更多信息.>

I upgraded to Ubuntu 13.10. At first when running apache after the update, there were missing/broken files, so I simply re-installed apache. I backed up the vhost file.

When trying to access my Laravel project from the browser, it get a 403 error. I have changed the permissions of the root folder multiple times, but it is still forbidden. I do not believe this is a laravel problem, as I already fixed it on 13.04, and I am using the same files.

Here is my 000-default.conf file, located in /sites-enabled and /sites-available. My apache2.conf file is unchanged since install.

<VirtualHost *:80>
    DocumentRoot /home/brennan/development/MasonACM/public

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /home/brennan/development/MasonACM/public/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log
    LogLevel warn
    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

It should also be important to note that my .htaccess file is not missing, and hasn't been changed since the site was working on 13.04.

UPDATE:

I have apache's host settings working now, but now the browser is displaying the actual code of index.php, meaning apache isn't using php for some reason. I just checked that php was installed, so why wouldn't apache recognize it?

解决方案

Apache2 may have also been upgraded to version 2.4, and there are a few things to note.

First, do you have Apache 2.4.x+ now? Check by running:

$ apache2 -v

If so, your vhost needs some adjustment:

First: +/- on Options:

Some Options parameters needs the +/- syntax. Read more here. This might be especially important when mixing +/- on some directives (read the previous link to see more).

Change:

Options Indexes FollowSymLinks MultiViews

to:

Options +Indexes +FollowSymLinks +MultiViews

Second: Allow/Deny

Apache now does access control via mod_authz_host

Change:

Order allow,deny
Allow from all

to:

Require all granted

Some more info here on upgrading from Apache 2.2 to 2.4.

这篇关于升级到 Ubuntu 13.10 后,laravel 项目在 Apache 上出现 403 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆