【问题标题】:Laravel project on ubuntu server :HTTP ERROR 500ubuntu 服务器上的 Laravel 项目:HTTP ERROR 500
【发布时间】:2016-06-16 13:21:32
【问题描述】:

我的 laravel 项目在开发机器上运行良好,但是当我上传到 ubuntu 服务器时,我会得到HTTP ERROR 500

这是我做过的事情。

1.将<laravel_project>文件夹的全部内容上传到var\www\html folder

当我尝试访问domain.com 时,我会得到目录列表而不是主页,当进入public 文件夹时,我会得到HTTP ERROR 500 错误。

还有如何在不访问公用文件夹的情况下获取索引页面(即我需要在输入domain.com时进入我的站点)。

【问题讨论】:

  • 我们不知道您使用的是哪个 http 服务器软件(nginxApache 等)。我们不知道 PHP 是如何配置的。我们不知道您的 http 服务器配置。您没有检查 http 服务器错误日志。基本上,您没有做任何事情或提供任何我们可以用来帮助您的东西。请在寻求帮助之前进行基本的错误分析。找出您使用的 http 服务器软件,找出它保存日志的位置,阅读日志,尝试从中确定出了什么问题以及是否仍然失败 - 回来提供更多信息。
  • Apache 是我的服务器软件,给我一些时间来更新服务器日志。

标签: php ubuntu laravel-5


【解决方案1】:

可能有多种情况

  1. 请检查您是否可以对存储文件夹进行存储写入权限
  2. 您需要在 apache 配置中定义公共路径才能在没有公共的情况下打开
  3. 服务器不满足 Laravel 的最低要求

请在上面尝试并告诉我

【讨论】:

  • 存储权限已开启,如何在apache配置中定义public路径?
  • 你能给我网址吗
  • 你可以直接联系我到ajay@froiden.com
  • 我会联系你的
  • 您可以更改apache配置上的文档根文件夹。转到位于/etc/apache2/sites-available 的配置文件(通常称为000-default.conf),然后将写有DocumentRoot 的行编辑为您需要的任何内容(在您的情况下为/var/www/html/public)。
【解决方案2】:

您必须更改 apache 配置文件中的文档根目录。 Ubuntu 服务器中的文件位置是: 1) $ cd /etc/apache2/sites-available 2) $ gedit 000-default.conf

找到默认的 Directory Root 并使用您的 project_directory / public_directory 对其进行修改。

DocumentRoot /var/www/html/project_dir/public/

请参阅此代码以供参考:

    <VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/project_dir/public_dir

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

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

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

编辑此文件后。重新加载 apache 服务器一次。

sudo service apache2 reload

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-22
    • 1970-01-01
    • 2018-04-20
    • 2019-09-17
    • 2018-08-27
    • 1970-01-01
    • 2016-11-06
    • 2021-11-20
    相关资源
    最近更新 更多