首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >新安装Laravel5.1并获得服务器500

问新安装Laravel5.1并获得服务器500
EN

Stack Overflow用户
提问于 2016-02-25 21:41:35
回答 1查看 116关注 0票数 0

我安装了Laravel5.1,通过composer为/storage和/bootstrap/cache设置预配置,并在sites enable/project.conf中创建vhost:

代码语言:javascript
复制
<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.
    ServerName www.sklad.dev

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/sklad/public

    <Directory /var/www/html/sklad/public>
        AllowOverride All
        Order allow,deny
        Allow from all
        # New directive needed in Apache 2.4.3: 
        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
    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
</VirtualHost>


# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

在/public/.htaccess中,我有:

代码语言:javascript
复制
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

我在apache2上启用了revrite并重新启动了apache.But,我仍然没有找到apache.But 500。你有什么问题吗?apache的日志是:

代码语言:javascript
复制
[Thu Feb 25 23:14:44.838725 2016] [:error] [pid 2505] [client 127.0.0.1:37241] PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/sklad/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/sklad/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:87\nStack trace:\n#0 /var/www/html/sklad/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/html/sklad/vendor/monolog/monolog/src/Monolog/Logger.php(289): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/sklad/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\\Logger->addRecord(400, Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#3 /var/www/html/sklad/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\\Logger->error(Object(Symfony\\Component\\Debug\\Exception\\FatalErrorException), Array)\n#4 /var/www/html/sklad/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\\Log\\Writer- in /var/www/html/sklad/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 87
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-02-25 22:21:43

您还没有为/storage设置完全正确的权限。它试图向日志写入错误,但没有创建或写入日志的权限。

要更改这一点,只需确保您正在递归地设置权限:

sudo chmod -R 777 /storage

但是,将权限设置为777可能会带来风险,因此使用您熟悉的权限级别,可能是775,因为这样可以让Laravel读取和写入日志文件。

您可能需要重新检查对其他文件夹的所有权限,以确保已递归设置它们。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35638934

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档