Codeigniter在nginx下配置rewrite

根目录:

location ~ \.php($|/) {
    root           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   $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

if (!-e $request_filename) {
    rewrite ^(.*)$ /$1 last;
    break;
}

子目录

location /CI/ {
    if (!-e $request_filename) {
        rewrite ^/CI/(.*)$ /CI/index.php/$1 last;
        break;
    }
 }
location /CI/index.php {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_split_path_info ^(.+\.php)(.*)$;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

452 total views, 4 views today

Revisions

There are no revisions for this post.

Comments are closed.