繁体   English   中英

ubuntu服务器上的Laravel项目:HTTP错误500

[英]Laravel project on ubuntu server :HTTP ERROR 500

我的laravel项目在开发机上工作正常,但是当我上传到ubuntu服务器时,我将收到HTTP ERROR 500

这是我做的事情。

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

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

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

可能有多种情况

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

请尝试以上,让我知道

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

查找默认的目录根目录,并使用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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM