Hướng dẫn cài đặt module Cache cho Openlitespeed
Mục lục:
Hướng dẫn cài đặt module Cache cho Openlitespeed
I. Giới thiệu
Mục đích của việc cài đặt module cache nhằm tăng khả năng load trang của trang web, nhằm tối ưu tối đa tốc độ load trang cho website của bạn.
Bạn có thể tham khảo thêm các link sau để cài đặt Openlitespeed: LINK
II. Hướng dẫn
Bước 1 : add module
WebAdmin console > Configuration > Server > Modules > Add
Bước 2: Tạo tên module và cài đặt các thông số
Tên : Cache
Thông số:
enableCache 1
qsCache 1
reqCookieCache 1
respCookieCache 1
ignoreReqCacheCtrl 0
ignoreRespCacheCtrl 0
expireInSeconds 2000
maxStaleAge 1000
enablePrivateCache 1
privateExpireInSeconds 1000
storagePath cachedata
Bước 3: Save và kiểm tra lại
Bước 4 : Enable cache trong rewrite
Phần rewrite tương tự như file .htaccess , nếu bạn cấu hình gì trong file htaccess thì bạn có thể cấu hình tương tự trong rewrite
Code : enable những file .php
RewriteRule cacheable/(.*\.php)?$ – [L,E=cache-control:max-age=120]
Code : enable cache mọi thứ
# this part is for private cache, note that HTTP_COOKIE is for loginuser
RewriteCond %{REQUEST_METHOD} ^HEAD|GET$
RewriteCond %{HTTP_COOKIE} loginuser
RewriteCond %{ORG_REQ_URI} !^/index.php$
RewriteCond %{ORG_REQ_URI} (\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule .* – [E=cache-control:private,L]