我的laravel项目在开发机器上工作正常,但是当我上传到ubuntu服务器时,我会得到HTTP ERROR 500
。
这是我做过的事情。
1.将<laravel_project>
文件夹的全部内容上传到var\www\html folder
。
当我尝试访问domain.com
时,我将获取目录列表而不是主页,当进入public
文件夹时,我将收到HTTP ERROR 500
错误。
如何在不访问公共文件夹的情况下获取索引页面(即我需要在输入domain.com
时输入我的网站)。
答案 0 :(得分:0)
可能有多种情况
请尝试以上并告诉我
答案 1 :(得分:0)
您必须在apache配置文件中更改Document根目录。
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