首页 > 其他 > 详细

CI框架中如何配置Nginx

时间:2016-04-01 20:30:19      阅读:200      评论:0      收藏:0      [点我收藏+]

codeigniter(CI)是一个轻量型的PHP框架,因为它是在apache服务器下开发的,所以在nginx下需要特别的配置才可以使用。

具体方法如下:

1.对application/config/config.php进行修改,大约在48行左右。

  $config[‘uri_protocol‘] = "PATH_INFO";
 
2.配置nginx.conf文件
 server {

        listen       80;

        listen [::]:80 ipv6only=on;

        server_name  localhost;

 

        #charset koi8-r;

 

        #access_log  logs/host.access.log  main;

 root   share/nginx/html;

            index  index.php index.html index.htm;

        location / {

            #root   share/nginx/html;

            #index  index.php index.html index.htm;

            try_files $uri $uri/ /index.php?$query_string;

        }

 

location ~ \.php($|/) {

            root           localhost;//类似于apache的host地址 例如:share/nginx/html;

            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 localhost$fastcgi_script_name; //这里的localhost指的是完整的root地址例如:/opt/local/share/nginx/html

            include        fastcgi.conf;

        }

 

CI框架中如何配置Nginx

原文:http://www.cnblogs.com/upliner/p/5345858.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!