最新消息: 新版网站上线了!!!

yii thinkphp nginx伪静态通用方法

server
{
listen       80;
server_name www.kuitao8.com kuitao8.com;
index index.html index.htm index.php default.html default.htm default.php;
# if ($host != 'www.kuitao8.com' ) {
     #         rewrite ^/(.*)$ http://www.kuitao8.com/$1 permanent;
      #    }
root  /var/www/kuitao8;
 
 
location ~ .*\.php($|/)
{      
             set $script     $uri;
             set $path_info  "";
        if ($uri ~ "^(.+?\.php)(/.+)$") {
            set $script     $1;
            set $path_info  $2;
        }
try_files $uri =404;
fastcgi_pass  unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
        fastcgi_param  SCRIPT_FILENAME    $document_root$script;
        fastcgi_param  SCRIPT_NAME        $script;
        fastcgi_param  PATH_INFO          $path_info;
}
 
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires      30d;
}
 
 
location ~ .*\.(js|css)?$
{
expires      12h;
}
                location / {
                        if (!-e $request_filename){
                             rewrite ^/(.*)$  /index.php/$1  last;
                            }
}
 
access_log  /usr/local/nginx/logs/www.kuitao8.com.log;
}

转载请注明:谷谷点程序 » yii thinkphp nginx伪静态通用方法