带有 Laravel 5“内部错误 500”的 apache 虚拟主机


apache virtual host with laravel 5 "Internal error 500"

我想学习 laravel,最近通过安装了 apache2 和 php 的 composer composer create-project laravel/laravel laravel-app在 Amazon ec2 实例上安装了一个新的副本 laravel。 我将 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 文件夹并将应用程序中的 url 更改为 42.66.33.52 .php ,但它仍然显示相同的错误。我是 laravel 的新手,我希望有人能为我指出正确的方向。我已经从这个服务器托管了其他PHP网站,没有使用laravel框架,它运行正常。

您应该chmod -R 775 /storage文件夹及其中的所有文件。

正如

@Alexey Mezenin所说,您应该更改存储的chmod和其中的所有文件-R,并且不要忘记对bootstrap/cache文件夹执行相同的操作。在官方 laravel 文档安装中的"目录权限"上检查:https://laravel.com/docs/5.3/installation

希望对;)有所帮助问候。