@
xiaopc #真静态 BEGIN Super Static Cache
location / {
#ngx_http_gzip_static_module and ngx_http_gunzip_module Must Be Added To Nginx
gzip_static always;
gunzip on;
if (-f $request_filename) {
break;
}
if ($uri ~ /(.*)$){
set $wpuri $1;
set $sscfile $document_root/super-static-cache/$1;
}
set $ssc Y;
if ($query_string !~ .*=.*){
set $ssc "${ssc}Y";
}
if ($request_method != "POST"){
set $ssc "${ssc}Y";
}
if (-f $sscfile.gz){
set $ssc "${ssc}F";
}
if (-f $sscfile/index.html.gz){
set $ssc "${ssc}I";
}
if ($ssc = YYYF){
rewrite . /super-static-cache/$wpuri break;
}
if ($ssc = YYYI){
rewrite . /super-static-cache/$wpuri/index.html break;
}
if (!-e $request_filename){
rewrite . /index.php last;
}
}
#End Super Static Cache