【问题标题】:apache virtual host with laravel 5 "Internal error 500"带有 laravel 5“内部错误 500”的 apache 虚拟主机
【发布时间】: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


【解决方案1】:

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

希望有所帮助;)问候。

【讨论】:

    【解决方案2】:

    您应该在/storage 文件夹及其中的所有文件上使用chmod -R 775

    【讨论】:

      猜你喜欢
      • 2021-03-28
      • 2013-10-16
      • 2018-11-10
      • 2017-06-02
      • 2015-01-31
      • 1970-01-01
      • 2015-04-29
      • 2016-08-12
      相关资源
      最近更新 更多