我想學習laravel,最近通過作曲家composer create-project laravel/laravel laravel-app
在apache2上安裝了一個amazon ec2實例的新副本laravel,並安裝了php。我配置conf.d文件,將文檔根目錄更改爲laravel-folder/public,當我嘗試去公共ip地址時,它顯示服務器500錯誤。apache虛擬主機與laravel 5「內部錯誤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 [email protected]
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網址42.66.33.52
,它仍然顯示了同樣的錯誤。我是laravel的新手,我希望有人能指出我正確的方向。我沒有使用laravel框架從這臺服務器託管其他PHP網站,並且它的功能正常。
您是否嘗試在DocumentRoot中使用完整路徑?你用-R(遞歸)做chmod 777嗎?檢查/存儲文件夾的權限(它和其中的所有文件應該有775或777)。另外,什麼Apache錯誤日誌說? –
哦哇感謝它現在的工作,我一定沒有使用-R。非常感謝。順便說一下,777的一切安全嗎? –
@DatTran我寧願用775而不用777,如果你想在你的生產服務器上使用這個站點(即公共/互聯網) – omrakhur