【发布时间】:2016-06-10 19:01:54
【问题描述】:
我想学习 laravel,最近通过 composercomposer create-project laravel/laravel laravel-app 和 apache2 在亚马逊 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
我已经尝试chmod 777 到整个laravel 文件夹并将app.php 中的url 更改为42.66.33.52,它仍然显示相同的错误。我是laravel的新手,我希望有人能指出我正确的方向。我在没有使用 laravel 框架的情况下从该服务器托管了其他 PHP 网站,它运行正常。
【问题讨论】:
-
您是否尝试在 DocumentRoot 中使用完整路径?你用 -R (递归)做了 chmod 777 吗?检查 /storage 文件夹的权限(它和其中的所有文件都应该有 775 或 777)。另外,apache 错误日志说什么?
-
哦,哇,谢谢它现在可以工作了,我一定没有使用-R。非常感谢。顺便说一句,用 777 拥有一切安全吗?
-
@DatTran 如果您想在生产服务器(即公共/互联网)上使用此站点,我宁愿使用 775 而不是 777
标签: php apache amazon-ec2 laravel-5