Wordpress

Instalasi

Debian 12

Update Repository

Pastikan repository sudah update

sudo apt-get update -y

Install Web Server

Install apache2

sudo apt install apache2 -y

Start dan enable service apache2

sudo systemctl enable apache2 && sudo systemctl start apache2

Pastikan apache2 sudah berjalan

sudo systemctl status apache2

Install PHP

Install PHP8.2 beserta dengan depedensinya

sudo apt-get install php8.2 php8.2-cli php8.2-common php8.2-imap php8.2-redis php8.2-snmp php8.2-xml php8.2-mysqli php8.2-zip php8.2-mbstring php8.2-curl libapache2-mod-php -y

Pastikan PHP sudah terinstall dengan cek versi

php -v

Install Database Server

Install mariadb server

sudo apt install mariadb-server -y

Start dan enable mariadb server

sudo systemctl start mariadb && sudo systemctl enable mariadb

Pastikan mariadb sudah berjalan

sudo systemctl status mariadb

Buat Database

Buat Wordpress database

CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'YourStrongPasswordHere';
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install Wordpress

Download dan install wordpress

cd /var/www/html
wget https://wordpress.org/latest.zip
unzip latest.zip
rm latest.zip

Set permissions untuk file dan folder

chown -R www-data:www-data wordpress/
cd wordpress/
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

Buka file wp-config.php

mv wp-config-sample.php wp-config.php
nano wp-config.php

Sesuaikan database dengan yang sudah dibuat sebelumnya

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'wordpress' );

/** Database password */
define( 'DB_PASSWORD', 'YourStrongPasswordHere' );

Buat Virtual Host

Buat file konfigurasi untuk virtual host

cd /etc/apache2/sites-available/
touch wordpress.conf

Tambahkan script untuk virtual host

<VirtualHost *:80>
ServerName yourdomain.com
DocumentRoot /var/www/html/wordpress

<Directory /var/www/html/wordpress>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Enamble konfigurasi apache untuk wordpress

sudo a2enmod rewrite
sudo a2ensite wordpress.conf

Cek sintak apakah sudah benar sebelum restart service dari apache

apachectl -t

Reload file konfigurasi yang baru ditambahkan

systemctl reload apache2

Akses WordPress melalui port http: http://127.0.0.1:80

Reference

Last updated