Php 带有laravel 5的apache虚拟主机;内部错误500“;
我想学习laravel,最近通过composerPhp 带有laravel 5的apache虚拟主机;内部错误500“;,php,apache,amazon-ec2,laravel-5,Php,Apache,Amazon Ec2,Laravel 5,我想学习laravel,最近通过composercomposer create project laravel/laravel laravel app和apache2在amazon ec2实例上安装了一个全新的副本laravel,并安装了php。我将conf.d文件配置为将文档根目录更改为laravel folder/public,当我尝试转到公共ip地址时,它会显示服务器500错误 <VirtualHost *:80> # The ServerName directive
composer create project laravel/laravel laravel app
和apache2在amazon ec2实例上安装了一个全新的副本laravel,并安装了php。我将conf.d文件配置为将文档根目录更改为laravel folder/public,当我尝试转到公共ip地址时,它会显示服务器500错误
<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.
#elastic IP address
ServerName 42.66.33.52
ServerAdmin webmaster@localhost
DocumentRoot laravel-app/public
<Directory laravel-app/public>
DirectoryIndex index.php
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
# 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
LogLevel warn
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
#ServerName指令设置请求方案、主机名和端口
#服务器使用来标识自身。这在创建时使用
#重定向URL。在虚拟主机的上下文中,服务器名
#指定必须在请求的主机:标头中显示的主机名
#匹配此虚拟主机。对于默认虚拟主机(此文件),此
#该值不是决定性的,因为它被用作最后的宿主。
#但是,必须为任何其他虚拟主机显式设置它。
#弹性IP地址
服务器名42.66.33.52
服务器管理员webmaster@localhost
DocumentRoot laravel应用程序/公共
DirectoryIndex.php
选项-索引+FollowSymLinks+多视图
允许超越所有
命令允许,拒绝
通融
要求所有授权
#可用日志级别:trace8、…、trace1、调试、信息、通知、警告、,
#错误、暴击、警报、紧急情况。
#还可以为特定应用程序配置日志级别
#模块,例如。
#日志级别信息ssl:警告
ErrorLog${APACHE_LOG_DIR}/error.LOG
日志级别警告
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
#对于conf/available/中的大多数配置文件
#在全局级别启用或禁用,可以
#仅包含一个特定虚拟主机的行。例如
#以下行仅为此主机启用CGI配置
#在使用“A2F”全局禁用后。
#包括conf available/service-cgi-bin.conf
我尝试了
chmod 777
到整个laravel文件夹,并将app.php中的url更改为42.66.33.52
,但仍然显示相同的错误。我是拉威尔的新手,我希望有人能给我指出正确的方向。我从这个服务器上托管了其他PHP网站,但没有使用laravel框架,它的功能正常 您应该在/storage
文件夹和其中的所有文件上chmod-R 775
。正如@Alexey Mezenin所说,您应该通过-R
更改存储的chmod和其中的所有文件,并且不要忘记对引导/cache
文件夹执行相同的操作。检查官方laravel文档安装中的“目录权限”:
希望你能帮忙;)注意。您是否尝试在DocumentRoot中使用完整路径?您是否使用-R(递归)执行chmod 777?检查/存储文件夹的权限(它和其中的所有文件应具有775或777)。还有,apache错误日志是怎么说的?哦,哇,谢谢,现在它工作了,我一定没有使用-R。非常感谢。顺便问一下,使用777是否安全?@DatTran如果您想在生产服务器(即公共/互联网)上使用此网站,我宁愿使用775而不是777