
WordPress di VPS bisa terasa lambat jika konfigurasinya generik. Padahal dengan tweak yang tepat, situs WordPress bisa load di bawah 1 detik bahkan tanpa CDN. Artikel ini berisi resep konfigurasi nyata yang bisa langsung Anda terapkan.
Stack yang Direkomendasikan: LEMP
- Nginx — web server ringan & cepat
- PHP-FPM 8.3 — runtime PHP modern
- MariaDB 10.11 — drop-in replacement MySQL, lebih cepat
- Redis — object cache
1. Aktifkan FastCGI Cache di Nginx
Ini fitur terpenting — full page cache di sisi web server, sebelum request bahkan sampai ke PHP.
fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=WORDPRESS:100m
inactive=60m max_size=1g;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
set $skip_cache 0;
if ($request_method = POST) { set $skip_cache 1; }
if ($query_string != "") { set $skip_cache 1; }
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php") { set $skip_cache 1; }
if ($http_cookie ~* "comment_author|wordpress_logged_in|wp-postpass") { set $skip_cache 1; }
location ~ \.php$ {
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 200 60m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
}
2. Tweak PHP-FPM Pool
Edit /etc/php/8.3/fpm/pool.d/www.conf:
pm = dynamic
pm.max_children = 30
pm.start_servers = 8
pm.min_spare_servers = 4
pm.max_spare_servers = 12
pm.max_requests = 500
3. Aktifkan OPcache (Wajib!)
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=1
opcache.revalidate_freq=60
4. Pasang Redis untuk Object Cache
apt install redis-server php8.3-redis -y
systemctl enable --now redis-server
Lalu install plugin Redis Object Cache dari WP-Admin → Plugins → Add New.
5. Tuning MariaDB untuk WordPress
Edit /etc/mysql/mariadb.conf.d/50-server.cnf:
[mysqld]
innodb_buffer_pool_size = 1G
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
max_connections = 100
slow_query_log = 1
long_query_time = 2
Restart: systemctl restart mariadb.
6. Aktifkan HTTP/2 + Brotli
listen 443 ssl http2;
Brotli memberi kompresi 15-25% lebih baik dari gzip — install module ngx_brotli jika belum ada.
7. Optimasi Gambar Otomatis
Pakai plugin seperti ShortPixel atau converter sisi server:
apt install webp -y
# Convert semua jpg/png ke webp
find /var/www/site/wp-content/uploads -type f \( -iname "*.jpg" -o -iname "*.png" \) \
-exec cwebp -q 80 {} -o {}.webp \;
8. Aktifkan Preload & Prefetch
Tambah header di Nginx:
add_header Link "<https://fonts.googleapis.com>; rel=preconnect";
9. Disable Hal yang Tidak Dipakai
- Disable XML-RPC jika tidak pakai Jetpack
- Disable emoji script di functions.php
- Limit revisi post:
define('WP_POST_REVISIONS', 5); - Disable cron internal:
define('DISABLE_WP_CRON', true);+ setup cron sistem
10. Test & Validasi
Sebelum & sesudah:
- PageSpeed Insights — target Performance > 90
- GTmetrix — TTFB < 200ms
curl -I https://domain.com— pastikan adaX-FastCGI-Cache: HIT
Kesimpulan
Dengan stack LEMP yang dituning seperti di atas, VPS 2 vCPU + 4 GB RAM bisa melayani ribuan visitor harian tanpa masalah. Kunci kemenangan ada di FastCGI Cache + Redis Object Cache + OPcache — tiga lapisan caching ini saja sudah cukup membuat WordPress terasa seperti situs statis. Sisanya adalah polish dan optimasi tingkat lanjut.