Setup VPS untuk WordPress tanpa Panel

Setup VPS untuk WordPress tanpa Panel

Setup VPS dengan benar akan membuat WordPress stabil, cepat, dan aman. Berikut langkah wajib yang harus dilakukan saat menyiapkan VPS baru untuk WordPress.


1. Update Server & Install Paket Dasar

Login ke server:

ssh root@IP-VPS

Update paket:

apt update && apt upgrade -y

Install tools penting:

apt install unzip curl nano ufw -y

2. Install Nginx

Install:

apt install nginx -y

Start dan enable:

systemctl start nginx
systemctl enable nginx

Test:

curl http://IP-VPS

3. Install MariaDB (Rekomendasi untuk WordPress)

Install:

apt install mariadb-server mariadb-client -y

Amankan database:

mysql_secure_installation

Masuk ke MySQL:

mysql

Buat database + user:

CREATE DATABASE wpdb;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'passkuat123';
GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

4. Install PHP-FPM + Extensions WordPress

Install PHP (contoh PHP 8.2):

apt install php8.2 php8.2-fpm php8.2-mysql php8.2-xml php8.2-curl php8.2-zip php8.2-gd php8.2-mbstring php8.2-soap php8.2-intl -y

Restart PHP:

systemctl restart php8.2-fpm

Cek versi:

php -v

5. Setup Root Folder untuk Website

Buat folder:

mkdir -p /var/www/domain.com

Set ownership:

chown -R www-data:www-data /var/www/domain.com
chmod -R 755 /var/www/domain.com

6. Konfigurasi Nginx untuk WordPress

Buat file config:

nano /etc/nginx/sites-available/domain.com

Isi dengan konfigurasi minimal:

server {
    server_name domain.com www.domain.com;
    root /var/www/domain.com;

    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~* \.(jpg|jpeg|png|gif|svg|css|js|woff|woff2|webp)$ {
        expires max;
        log_not_found off;
    }
}

Enable config:

ln -s /etc/nginx/sites-available/domain.com /etc/nginx/sites-enabled/

Test Nginx:

nginx -t
systemctl reload nginx

7. Install SSL (Let’s Encrypt)

Install Certbot:

apt install certbot python3-certbot-nginx -y

Issue SSL:

certbot --nginx -d domain.com -d www.domain.com

Renew otomatis:

systemctl enable certbot.timer

8. Download & Install WordPress

Masuk ke folder:

cd /var/www/domain.com

Download:

wget https://wordpress.org/latest.zip
unzip latest.zip
mv wordpress/* .
rm -rf wordpress latest.zip

Set permission ulang:

chown -R www-data:www-data /var/www/domain.com
chmod -R 755 /var/www/domain.com

9. Setup WordPress via WP-CLI (Opsional tapi direkomendasikan)

Install WP-CLI:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/local/bin/wp

Generate config:

wp config create --dbname=wpdb --dbuser=wpuser --dbpass=passkuat123 --dbhost=localhost

Install WordPress:

wp core install \
  --url="https://domain.com" \
  --title="Site Title" \
  --admin_user=admin \
  --admin_password=passkuat123 \
  [email protected]

10. Setting Firewall

Aktifkan UFW:

ufw allow OpenSSH
ufw allow 'Nginx Full'
ufw enable

Cek:

ufw status

11. Optimasi Server (Wajib)

Optimasi Nginx FastCGI Cache (Powerful)

Install:

apt install nginx-extras -y

Tambah di nginx.conf (optional):

fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=WORDPRESS:10m inactive=60m;

Di server block:

set $skip_cache 0;

location ~ \.php$ {
    fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    fastcgi_cache WORDPRESS;
    fastcgi_cache_valid 200 60m;
    add_header X-Cache $upstream_cache_status;
}

12. Backup & Snapshot (Opsional tapi penting)

Backup manual dengan WP-CLI:

wp db export backup.sql

Backup folder:

tar -czvf backup-files.tar.gz /var/www/domain.com
Built with Breakdance.
©2025 All rights reserved.