免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1673 | 回复: 0
打印 上一主题 下一主题

CI在nginx的重写规则设定 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-31 16:15 |只看该作者 |正序浏览

user  www;
worker_processes  5;
error_log   /var/log/nginx-error.log;
pid        /tmp/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    root /usr/local/www/data;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log   /var/log/nginx-access.log  main;
    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;
    gzip  on;
    server {
        listen       80;
        server_name  test.com;
        access_log  /var/log/test.com.access.log  main;
        location / {
                index index.php;
                root /usr/local/www/data/your/path/to/CI/;
                if ($request_filename !~ (js|css|images|robots\.txt|index\.php) ) {
                        rewrite ^/(.*)$ /index.php?/$1 last;
                }
        }
location ~ /index.php/
  {
    include        fastcgi_params;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /usr/local/www/data/your/path/to/CI/index.php;
    fastcgi_param  REQUEST_URI      $request_uri;
    fastcgi_param  QUERY_STRING     $query_string;
    fastcgi_param  REQUEST_METHOD   $request_method;
    fastcgi_param  CONTENT_TYPE     $content_type;
    fastcgi_param  CONTENT_LENGTH   $content_length;
    fastcgi_pass   127.0.0.1:9000;
  }
        location /phpMyAdmin/ {
            alias /usr/local/www/data/phpMyAdmin/;
            index  index.php;
        }
        error_page   500 502 503 504  /50x.html;
        
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }
        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/data/your/path/to/CI/$fastcgi_script_name;
            include        fastcgi_params;
        }
        location ~ /\.ht {
            deny  all;
        }
    }
}


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/10668/showart_2042156.html
  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP