凤眠

先行后知,知行合一

导航

使用nginx部署Yii 2.0\yii-basic-app-2.0.5

Posted on 2015-08-06 10:55  凤眠  阅读(383)  评论(0编辑  收藏  举报

nginx.conf

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
       worker_connections 1024;
}


http {
   include mime.types;
   default_type application/octet-stream;

   sendfile on;

   keepalive_timeout 65;

   client_max_body_size 8M;

   client_body_buffer_size 128k; 

   server {

     listen 80;
     server_name localhost;

     root E:/xampp/htdocs/html5/php/yii-basic-app-2.0.5/basic/web;
     index index.php;

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

     error_page 500 502 503 504 /50x.html;

     location = /50x.html {
       root html;
     }

     location ~ \.php$ {
       fastcgi_pass 127.0.0.1:9000;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
     }

   }

}

说明:启动php、nginx之后,使用浏览器访问http://localhost/即可

参考:安装 Yii - Yii 2.0 权威指南 - 文档 - Yii Framework 中文社区

   PHP For Windows/php-5.6.11-Win32-VC11-x64启动脚本