Skip to content

Instantly share code, notes, and snippets.

@takien
Created August 18, 2025 03:36
Show Gist options
  • Save takien/f0a83cfd4339a52747973e10d6906dc5 to your computer and use it in GitHub Desktop.
Save takien/f0a83cfd4339a52747973e10d6906dc5 to your computer and use it in GitHub Desktop.
Membuat RapidCache atau CometCache akses langsung ke file statis HTML
set $domain_dir parahitatour-com;
set $cache_path /wp-content/cache/rapid-cache/cache/https/$domain_dir;
location ~ ^(?<filename>/.+)/$ {
sub_filter '<!--headers' ' ';
sub_filter 'a:' '<!-- a:';
try_files $uri $uri/ $cache_path/$filename.html /index.php$args;
}
location = / {
sub_filter '<!--headers' ' ';
sub_filter 'a:' '<!-- a:';
sub_filter_once on;
try_files $cache_path/index.html /index.php$args;
}
location / {
sub_filter '<!--headers' ' ';
sub_filter 'a:' '<!-- a:';
try_files $uri $uri/ $cache_path/$uri.html /index.php?$args;
}
location = /robots.txt {
try_files $uri/ /index.php?$args;
access_log off;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
#jangan lupa sesuaikan versi PHP nya di sini
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS $ssl;
fastcgi_read_timeout 300;
include fastcgi.conf;
}
location ~* \.(js|css|png|jpg|jpeg|gif|svg|ico|eot|otf|ttf|woff|txt|pdf|doc|docx|xls|xlsx|ppt|pptx|sql|csv|zip|rar|html|xml|xsl)$ {
if (-f $request_filename) {
expires 365d;
access_log off;
break;
}
try_files $uri/ /index.php?$args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment