1. Persiapan Awal
Login ke VPS: Gunakan SSH untuk login ke server:
bash
Salin kode
ssh username@your_server_ip
Update Sistem:
bash
Salin kode
sudo apt update && sudo apt upgrade -y
Install Paket Dasar: Instal paket yang diperlukan, seperti curl, wget, atau lainnya:
bash
Salin kode
sudo apt install curl wget unzip -y
2. Install LEMP Stack (Linux, Nginx, MySQL, PHP)
Install Nginx:
bash
Salin kode
sudo apt install nginx -y
Aktifkan dan jalankan Nginx:
bash
Salin kode
sudo systemctl start nginx
sudo systemctl enable nginx
Install MySQL (atau MariaDB):
bash
Salin kode
sudo apt install mysql-server -y
Amankan instalasi MySQL:
bash
Salin kode
sudo mysql_secure_installation
Buat database dan user untuk WordPress:
sql
Salin kode
CREATE DATABASE wordpress_db;
CREATE USER ‘wordpress_user’@’localhost’ IDENTIFIED BY ‘your_password’;
GRANT ALL PRIVILEGES ON wordpress_db.* TO ‘wordpress_user’@’localhost’;
FLUSH PRIVILEGES;
EXIT;
Install PHP: Instal PHP dan ekstensi yang dibutuhkan oleh WordPress:
bash
Salin kode
sudo apt install php-fpm php-mysql php-curl php-xml php-mbstring -y
Periksa versi PHP untuk memastikan instalasi:
bash
Salin kode
php -v
3. Download dan Konfigurasi WordPress
Download WordPress:
bash
Salin kode
wget https://wordpress.org/latest.zip
unzip latest.zip
sudo mv wordpress /var/www/html/
Set Permission untuk WordPress:
bash
Salin kode
sudo chown -R www-data:www-data /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
Konfigurasi File wp-config.php: Salin file konfigurasi bawaan WordPress:
bash
Salin kode
cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
Edit file:
bash
Salin kode
sudo nano /var/www/html/wordpress/wp-config.php
Isi informasi database:
php
Salin kode
define(‘DB_NAME’, ‘wordpress_db’);
define(‘DB_USER’, ‘wordpress_user’);
define(‘DB_PASSWORD’, ‘your_password’);
define(‘DB_HOST’, ‘localhost’);
4. Konfigurasi Nginx
Buat File Konfigurasi untuk WordPress:
bash
Salin kode
sudo nano /etc/nginx/sites-available/wordpress
Isi file dengan konfigurasi berikut:
nginx
Salin kode
server {
listen 80;
server_name your_domain_or_ip;
root /var/www/html/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Aktifkan Konfigurasi dan Restart Nginx: Simpan file, lalu aktifkan konfigurasi:
bash
Salin kode
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
5. Akses WordPress
Buka Browser: Akses http://your_server_ip atau domain Anda.
Ikuti Panduan Instalasi WordPress: Isi nama situs, admin username, dan password untuk menyelesaikan instalasi.
6. Tambahan (Opsional)
Aktifkan HTTPS: Instal dan konfigurasikan Certbot untuk SSL gratis:
bash
Salin kode
sudo apt install certbot python3-certbot-nginx -y
sudo certbot –nginx -d your_domain
Konfigurasi Caching dan Performance:
Install plugin caching seperti WP Super Cache.
Gunakan ekstensi PHP seperti OPcache untuk meningkatkan performa.