2016-02-25 37 views
0

我通过作曲家集premissions安装Laravel 5.1 /存储和/引导/缓存,并创建虚拟主机站点启用/ project.conf:全新安装Laravel 5.1,并得到服务器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. 
    ServerName www.sklad.dev 

    ServerAdmin [email protected] 
    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 
在/公共

/我的.htaccess有:

<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> 

我启用revrite MOD上的Apache2和重启apache.But我仍然找不到服务器500。你有一些什么样的IDE可以是错的?而来自Apache的日志是:

[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 
+0

为什么不检查错误日志?你在运行什么服务器?日志通常存储在Linux服务器的'/ var/log/apache2/error.log'中。 – James

+0

我编辑我的问题并添加apache日志。 –

回答

2

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

要改变这只是确保你递归地设置您的权限:

sudo chmod -R 777 /storage

设置权限777虽然能带来的风险,所以使用权限级别,你是舒服,也许775作为这将让Laravel读取和写入日志文件。

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

+0

谢谢,我忘了这:)谢谢 –