码迷,mamicode.com
首页 > 其他好文 > 详细

CI框架中如何配置Nginx

时间:2016-04-01 20:31:19      阅读:192      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!