【问题标题】:Can't get Laravel 4.2 to work / 404无法让 Laravel 4.2 工作/404
【发布时间】:2016-04-11 07:16:48
【问题描述】:

我已经尝试安装和重新安装并尝试了几十种可能的解决方案,但都没有奏效。

我将 Laravel 4.2 安装到 /var/www/project

然后我创建了一个新的虚拟主机:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/project/public

    <Directory /var/www/project/public>
        # Don't show directory index
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

并通过以下方式启用它:

sudo a2ensite project.conf

然后重新启动 apache2。但是,当我转到我的域时,我得到的只是 404:

Not Found

The requested URL / was not found on this server.

我做错了什么?

【问题讨论】:

  • 试试 /index.php 能行吗?
  • @Artisan72 不,仍然得到 404。

标签: apache laravel laravel-4


【解决方案1】:

固定。

我不得不:

sudo a2dissite 000-default.conf

【讨论】:

    【解决方案2】:

    如果你使用的是 Linux,添加这个

    ServerName projectname
    

    下面&lt;VirtualHost&gt;

    添加行

    127.0.0.1   projectname 
    

    etc/hosts 文件。所以它应该可以工作而不必禁用其他网站。

    重新启动您的 apache 并使用 http://projectname 对其进行测试。

    【讨论】:

      猜你喜欢
      • 2015-04-27
      • 2015-11-06
      • 2014-11-27
      • 1970-01-01
      • 2014-11-16
      • 2016-08-12
      • 1970-01-01
      • 2014-09-30
      • 2015-01-12
      相关资源
      最近更新 更多