as今天准备把网站搬迁到nginx上发现codeigniter框架在nginx上不能使用,后来发现是nginx不支持pathinfo,下面介绍怎么在nginx下开启pathinfo和去掉index.php

location / {
    # 这里使用try_files进行url重写,不用rewrite了。
    try_files $uri $uri/ /index.php?$query_string;
}
 
location ~ \.php($|/) {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param   PATH_INFO $fastcgi_path_info;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

 

 posted on 2015-03-23 18:08  whlives  阅读(712)  评论(0编辑  收藏  举报