Yii的Nginx rewrite

如下为nginx yii的重写

server {
set $host_path "/data/site/www.jb51.net";
 access_log /data/logs/nginx/www.jb51.net_access.log main;
server_name jb51.net www.jb51.net;
root $host_path/htdocs;
 set $yii_bootstrap "index.php";
# define charset
 charset utf-8;
location / {
 index index.html $yii_bootstrap;
 try_files $uri $uri/ /$yii_bootstrap"htmlcode">
server {
 listen 80;
 server_name www.jb51.net;
root /data/site/www.jb51.net;
 index index.php;
access_log /data/logs/nginx/www.jb51.net_accerss.log;
 error_log /data/logs/nginx/www.jb51.net_error.log;
# main cakephp rewrite rule
 location / {
 try_files $uri $uri/ /index.php?$uri&$args;
 }
location ~ .php$ {
 root /data/site/www.jb51.net;
 try_files $uri =404;
 fastcgi_pass unix:/tmp/php5-fpm.sock; # 改成你对应的FastCGI
 fastcgi_index index.php;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 fastcgi_buffer_size 128k;
 fastcgi_buffers 256 4k;
 fastcgi_busy_buffers_size 256k;
 fastcgi_temp_file_write_size 256k;
 }
}

重启nginx即可

标签:
Yii,CakePHP,rewrite,Nginx,配置,Nginx配置

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com