Drupal7 Boost Nginx設定筆記

location / {
                try_files $uri @cache;
        }

    try_files $uri @cache;
    }

    location @cache {
    if ($http_cookie ~ "DRUPAL_UID") { return 405; }
    if ($request_method !~ ^(GET|HEAD)$ ) { return 405; }
    error_page 405 = @drupal;
    gzip on;
    gzip_http_version 1.1;
    gzip_vary on;
    gzip_comp_level 6;
    gzip_proxied any;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
    gzip_buffers 16 8k;
    add_header Expires "Tue, 22 Sep 1974 08:00:00 GMT";
    add_header Cache-Control "must-revalidate, post-check=0, pre-check=0";
    try_files /cache/normal/$host/${uri}_${args}.html /cache/perm/$host/${uri}_.css /cache/perm/$host/${uri}_.js /cache/$host/0$uri.html /cache/$host/0${uri}/index.html @drupal;
}

location @drupal {
        rewrite ^/(.*)$ /index.php?q=$1;
    }


把原本的 location / { }
                改成只剩下 try_files $uri @cache;


來源
https://www.drupal.org/node/1666080

gzip那段是我隨便抄的,應該可用吧 XD

留言

熱門文章