转自: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. python 三分钟入门

    1.Python环境配置(2.7版本): Python官网:https://www.python.org/ Pycharm官网 http://www.jetbrains.com/pycharm/dow ...

  2. UIStackView 简单使用

    UIStackView提供了一个高效的接口用于平铺一行或一列的视图组合.对于嵌入到StackView的视图,你不用再添加自动布局的约束了.Stack View管理这些子视图的布局,并帮你自动布局约束. ...

  3. Android中JNI编程的那些事儿(1)

    转:Android中JNI编程的那些事儿(1)http://mobile.51cto.com/android-267538.htm Android系统不允许一个纯粹使用C/C++的程序出现,它要求必须 ...

  4. 运维安全系列基础服务之 FTP 服务(系列一)

    做了多年运维工程师,积攒了一些经验,和大家分享下.个人认为,运维安全话题的系列,主要包括下面四个方面: 基础服务 网络层 应用层 云安全 今天主要讲的是基础服务里面的[FTP服务][ftp]. 文件传 ...

  5. Android 连接tomcat模拟登陆账号

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools=&q ...

  6. 编译GNU/Linux共享库, 为什么要用PIC编译?

    http://blog.csdn.net/chenji001/article/details/5691690

  7. 杂烩:QWidget、QGraphics、QtQuick

    一说起Qt 大都会想起Qt的GUI编程,具体到某个类的话,最多的就是QWidget类及其子类了. 其实Qt中还有基于项的图形视图,具体来说QGraphicsView,QGraphicsScene,QG ...

  8. JDBC事务控制管理

    1.事务 (1)事务的概念 事务指逻辑上的一组操作,组成这组操作的各个单元,要不全部成功,要不全部不成功. 例如:A——B转帐,对应于如下两条sql语句 update account set mone ...

  9. RMA Sales Order – Stuck with “Awaiting Return Disposition”

    RMA Sales Order – Stuck with "Awaiting Return Disposition"                     Action : (P ...

  10. B. Fixed Points

    B. Fixed Points time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...