nginx 配置 boost

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
set $boost "";
set $boost_query "_";
if ( $request_method = GET ) {
    set $boost G;
  }
  if ($http_cookie !~ "DRUPAL_UID") {
    set $boost "${boost}D";
  }
  if ($query_string = "") {
    set $boost "${boost}Q";
  }
  if ( -f $document_root/cache/normal/$host$request_uri$boost_query.html ) {
    set $boost "${boost}F";
  }
  if ($boost = GDQF){
    rewrite ^.*$ /cache/normal/$host/$request_uri$boost_query.html break;
  }
  if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      break;
  }