Yiiframework pathinfo 模式下nginx设置

server {
    listen       80;
    server_name  www.rmd.com;
    root           D:/Workspace/php/sites/training-cn/rmd;
    set $index   "index.php";
    charset utf-8;

    location / {
        index  index.html $index;
        try_files $uri $uri/ /$index?$args;
    }

    location ~ ^/(protected|framework|themes/w+/views) {
        deny  all;
    }

    location ~ .(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
        try_files $uri =404;
    }

    location ~ .php {

        fastcgi_split_path_info  ^(.+.php)(.*)$;

        set $fsn /$index;
        if (-f $document_root$fastcgi_script_name){
            set $fsn $fastcgi_script_name;
        }

        fastcgi_pass   127.0.0.1:9000;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fsn;
        fastcgi_param  PATH_INFO        $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fsn;
    }

    location ~ /.ht {
        deny  all;
    }

}
原文地址:https://www.cnblogs.com/luowen/p/4386395.html