即使路由存在,也会出现错误404 - AWS,Laravel

时间:2016-03-08 22:29:44

标签: php laravel amazon-web-services amazon-ec2

我刚在AWS EC2上创建了一个新实例。我有一个现有的laravel项目,将它推送到github并将其安装在我的新实例上。还安装了composer,php,mysql,apache。当我点击public网址时,laravel会将我重定向到public/auth/login。在我的localhost上一切都很好,但在这里它给出了错误404 - Not Found The requested URL /auth/login was not found on this server.。我已在AWS中的laravel项目之前安装但从未遇到过这样的错误。什么可能出错?

3 个答案:

答案 0 :(得分:2)

所有内容都来自.htaccess文件。我添加了AllowOverride All,现在一切正常!

答案 1 :(得分:0)

假设您使用的是默认的Amazon Linux,您可以编辑/etc/httpd/conf/httpd.conf并设置DocumentRoot "<your path to your app>/public",然后使用sudo service httpd restart重启Apache。

答案 2 :(得分:0)

如果您使用的是Apache服务器,请执行以下操作

  1. 转到您的apache2.conf文件, 例如在ubuntu中,路径为 /etc/apache2/apache2.conf
  2. 通过进行适当的修改粘贴以下代码
<Directory /var/www/the_root_of_your_laravel_project_where_index.php_exists/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
相关问题