转自:http://www.nginx.cn/1134.html

nginx如何配置才能支持codeigniter ?

1. codeigniter的url美化去掉index.php

 
1
2
3
4
5
        location / {
            root   html/gxtp;
            index  index.php;
            try_files $uri $uri/ /index.php?$uri&$args;
        }

2.与thinkphp一样codeigniter的url rewrite也是使用pathinfo来实现的,需要借助fastcgi_split_path_info来设置$_SERVER['PATHINFO']。

 
1
2
3
4
5
6
7
8
9
10
        location ~ ^.+.php {
           include        fastcgi_params;
           root           html/gxtp;
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        }

codeigniter完整版nginx.conf规则

 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
worker_processes  1;
 
events {
    worker_connections  1024;
}
 
http {
    include       mime.types;
    default_type  application/octet-stream;
 
    sendfile        on;
    keepalive_timeout  65;
 
    server {
        listen       80;
        server_name  www.264.cn;
 
        location / {
            root   html/kdw;
            index  index.php;
            try_files $uri $uri/ /index.php?$uri&$args;
        }
 
        location ~ ^.+.php {
           include        fastcgi_params;
           root           html/kdw;
           fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
           fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
           fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
           fastcgi_param PATH_INFO $fastcgi_path_info;
           fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        }
    }
}

codeigniter nginx rewrite规则配置【转】的更多相关文章

  1. Nginx系列二:(Nginx Rewrite 规则、Nginx 防盗链、Nginx 动静分离、Nginx+keepalived 实现高可用)

    一.Nginx Rewrite 规则 1. Nginx rewrite规则 Rewrite规则含义就是某个URL重写成特定的URL(类似于Redirect),从某种意义上说为了美观或者对搜索引擎友好, ...

  2. 【转】 nginx rewrite 伪静态配置参数详细说明

    nginx rewrite 伪静态配置参数和使用例子 附正则使用说明 正则表达式匹配,其中: * ~ 为区分大小写匹配  * ~* 为不区分大小写匹配  * !~和!~*分别为区分大小写不匹配及不区分 ...

  3. [转】 nginx rewrite规则

    http://www.cnblogs.com/cgli/archive/2011/05/16/2047920.html 最近在VPS上尝试配置安装一个网站,VPS安装了LNMP(Linux+Nginx ...

  4. Nginx Rewrite规则记录

    Rewrite 是一种服务器的重写脉冲技术,它可以使得服务器可以支持 URL 重写,是一种最新流行的服务器技术.它还可以实现限制特定IP访问网站的功能.很多情况下,某个 IP 的访问很容易造成 CPU ...

  5. Nginx rewrite 规则 与 proxy_pass 实现

    Nginx rewrite 规则  与 proxy_pass 实现     -------------------------------------------------------------- ...

  6. Nginx Rewrite规则详解

    Rewrite规则含义就是某个URL重写成特定的URL,从某种意义上说为了美观或者对搜索引擎友好,提高收录量及排名等. Rewrite规则的最后一项参数为flag标记,支持的flag标记主要有以下几种 ...

  7. [转帖]Nginx rewrite 规则 与 proxy_pass 实现

    Nginx rewrite 规则 与 proxy_pass 实现 https://www.cnblogs.com/jicki/p/5546916.html Nginx rewrite 规则  与 pr ...

  8. Nginx Rewrite规则

    location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A ] } location / { # 因为所有的地址都以 / 开头,所以这条规则将匹配 ...

  9. Nginx Rewrite规则初探(转)

    Nginx  rewrite(nginx url地址重写)Rewrite 主要的功能就是实现URL的重写,Nginx的Rewrite规则采用Pcre,perl兼容正则表达式的语法规则匹配,如果需要Ng ...

随机推荐

  1. git之环境配置(window+git+github)

    本地安装git 下载最新版的git:https://msysgit.googlecode.com/files/Git-1.9.0-preview20140217.exe 安装步骤:http://jin ...

  2. HTML -- 元素和属性

    HTML -- 元素 HTML元素是从开始标签到结束标签之间的代码,如: <!-- 加粗标签 --> <b>一些元素</b> <!-- 换行 --> & ...

  3. PhoneGap 3 在 Mac 上安装使用

    1.下载安装 NodeJS . 2.安装 PhoneGap.打开终端执行: 1 $ sudo npm install -g phonegap 3.PhoneGap 3 不需要在Xcode中创建,而是在 ...

  4. 小Z的创业经历 谢谢支持

    写这篇文章的目的是跟大家分享下创业的一些想法,经历.希望对你有所帮助或有所思考.  我想用6篇文章介绍下前期创业经历 1.怎么创业了? 2.万事开头难,怎么开始呢? 3.我们的系统详情(上) 4.我们 ...

  5. underscore

    http://www.byywee.com/page/M0/S819/819654.html http://www.haogongju.net/art/1127253 http://hi.baidu. ...

  6. Cloud Test 在手,宕机时让您不再措手不及

    1月28日,Github 上午 10:04 分宕机了,导致全球各地的用户不能访问.官方回复可能是网络中断引起的,到 10:28 分已经可以正常访问. 对于互联网公司来说,一旦宕机就会措手不及,如何才能 ...

  7. python加密解密

    from Crypto.Cipher import Blowfish  #easy_install pycrypto可以获得

  8. malloc(0)的问题

    http://blog.csdn.net/js_xj/article/details/5826042 解答: 首先来解释malloc(0)的问题,这个语法是对的,而且确实也分配了内存,但是内存空间是0 ...

  9. 【Xamarin挖墙脚系列:卸载不彻底的解决】

    原文:[Xamarin挖墙脚系列:卸载不彻底的解决] 卸载后,再次安装,总是授权还是原来的.请手工删除下文件: 卸载程序后 必须手工删除C:\ProgramData\Mono for Android\ ...

  10. bower初接触

    之前从Steve Sanderson的博文Architecting large Single Page Applications with Knockout.js中学习了用Yeoman创建Knocko ...