转自: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. C#中判断bool 类型 代码的最短写法

    看到一个关于写最短代码的,  是一个bool类型判断的:    public bool IsNull(object val) { if (val == null) { return true; } e ...

  2. WebForm中TreeView的使用

    protected void Page_Load(object sender, EventArgs e)        {            DatabaseBind();            ...

  3. uva 10652 Board Wrapping

    主要是凸包的应用: #include <cstdio> #include <cmath> #include <cstring> #include <algor ...

  4. Delphi组件indy 10中IdTCPServer修正及SSL使用心得

    indy 10终于随着Delphi2005发布了,不过indy套件在我的印象中总是复杂并且BUG不断,说实话,不是看在他一整套组件的面子上,我还是喜欢VCL原生的Socket组件,简洁,清晰.Indy ...

  5. 解析Android开发优化之:对Bitmap的内存优化详解

    在Android应用里,最耗费内存的就是图片资源.而且在Android系统中,读取位图Bitmap时,分给虚拟机中的图片的堆栈大小只有8M,如果超出了,就会出现OutOfMemory异常.所以,对于图 ...

  6. struts一点心得

    action中: 设置属性并增加get,set方法,给属性赋值后 (如: private String name; public String getName() { return name; } p ...

  7. 【转并修改】VS2013 MVC Web项目使用内置的IISExpress支持局域网内部机器(手机、PC)访问、调试

    转:http://www.cnblogs.com/ShaYeBlog/p/4072074.html VS2013内置了IISExpress.做asp.net MVC的web项目开发时,Ctrl+F5和 ...

  8. 【HDOJ】1963 Investment

    完全背包. #include <stdio.h> #include <string.h> #define max(a, b) (a>b) ? a:b ], an[]; ] ...

  9. linux字符图形界面

    /etc/inittab 1)  字符界面标识: id:3:initdefault: 2)  图形界面标识: id:5:initdefault:   [root@ora9i ~]# vi /etc/i ...

  10. c#中使用SESSION需要注意的几个问题

    C#的SESSION和其它程序中的SESSSION可能有一点的不同,下面讲下哪飞网程序员遇到的一个地方使用SESSION的问题.希望对大家有所帮助 一.在页面中用SESSION,存值session[& ...