使用php 5.6为laravel(v 5)配置nginx(v 1.10)

时间:2016-08-27 17:00:48

标签: php nginx laravel-5

nginx的配置在这里:

user nginx;
worker_processes  4;
events {
worker_connections  1024;
}

http {
include       mime.types;
default_type  application/octet-stream;
sendfile        on;
keepalive_timeout  65;
include /usr/local/nginx/conf/virtual/*.conf;
}

虚拟文件中的virtual.conf: 配置为laravel应用程序提供服务的虚拟主机,它会显示出来 这里:

server {  
listen 80 default_server;

root /www/laravel/public;
index index.html index.htm index.php;

server_name laravel.mysite.cn;

charset utf-8;

location / {
    try_files \$uri \$uri/ /index.php?\$query_string;
}

 # Note this will work with "hack" files as well as php files!
 location ~ \.(hh|php)$ {  
      fastcgi_keep_conn on;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include        fastcgi_params;
 }

# Deny .htaccess file access
location ~ /\.ht {
    deny all;
}
}

Chrome报告500错误

enter image description here

Nginx错误日志:最新错误日志

2016/08/28 11:20:56 [error] 24541#0: *9 FastCGI sent in stderr: "PHP             message: PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with  message 'The stream or file "/www/laravel/storage/logs/laravel.log" could not be  opened: failed to open stream: Permission denied' in    /www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:#0/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
   #1 /www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)
   #2 /www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)
   #3 /www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)
   #4 /www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array)
   #5 /www/lar...


PHP message: PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:#0/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
  #1 /www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)
  #2 /www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)
  #3 /www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)
  #4 /www/laravel/vendor/laravel/framework/src/Illum

0 个答案:

没有答案