Tahapan Setup Wordpress di VPS Menggunakan Apache | pakarbot

Tahapan Setup WordPress di VPS Menggunakan Apache

Seting DNS (lihat video part #1 di https://www.pakarbot.com/vps-mastery-8-step-by-step-setup-wordpress-dari-nol-di-vultr/)

Connect ke server via SSH menggunakan putty -> https://youtu.be/ANu10Hkxip4

Buat user baru non root

# adduser userpakarbot
# usermod -aG sudo userpakarbot

Lihat videonya di sini -> https://youtu.be/ZX8Dv-Al4XQ

Install apache

Sebelum mulai install apache silahkan close dulu putty-nya kemudian buka lagi, login lagi menggunakan user non root yang baru saja kita buat sebelumnya.

$ sudo apt update
$ sudo apt install apache2
$ sudo ufw app list
$ sudo ufw allow 'Apache Full'
$ sudo ufw status
$ sudo a2enmod rewrite <- untuk enable modul rewrite apache
$ sudo nano /etc/apache2/apache2.conf


kemudian cari baris script yang seperti ini

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Pastikan allowoverride nya all

/etc/init.d/apache2 restart

Lihat videonya di sini -> https://youtu.be/9v7kuMJGxyA

Install MySQL

$ sudo apt-get install mysql-server

Lihat videonya di sini -> https://youtu.be/PjTFTedPtUc

Install PHP

$ sudo apt install php-fpm php-mysql
$ sudo apt show php -a

Lihat videonya di sini -> https://youtu.be/NpIm1k9jpx8

Install 2 Versi PHP Dalam 1 Server

$ sudo apt-get install software-properties-common -y
$ sudo add-apt-repository ppa:ondrej/php
$ sudo add-apt-repository ppa:ondrej/apache2
$ sudo apt-get update -y
$ sudo apt-get install php7.4 php7.4-fpm php7.4-mysql libapache2-mod-php7.4 libapache2-mod-fcgid -y
$ sudo systemctl start php7.4-fpm
$ sudo a2enmod actions fcgid alias proxy_fcgi
$ sudo systemctl restart apache2

Lihat videonya di sini -> https://youtu.be/3zwFgKp59JM

Ubah Default Versi PHP

$ php -v <- untuk cek versi default php
$ sudo update-alternatives --set php /usr/bin/php7.4
$ php -v <- untuk cek versi default php sudah berubah atau belum

Lihat videonya di sini -> https://youtu.be/7jhfDeAvaTM

Konfigurasi PHP max_execution_time Untuk PGP

$ sudo nano /etc/php/7.4/fpm/php.ini
cari baris:
max_execution_time = 30

ubah ke:
max_execution_time = 1800

$ sudo /etc/init.d/php7.4-fpm restart

Lihat videonya di sini -> https://youtu.be/18EXEj7tHpw

Menambahkan Domain/Addon Domain/Sub Domain Ke Apache

$ cd /etc/apache2/sites-available
$ sudo cp 000-default.conf namadomain.com.conf
$ sudo nano namadomain.com.conf

Edit ServerName, ServerAlias, dan directory (lihat video)
tambahkan
---
<FilesMatch \.php$>
      # For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
      SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    </FilesMatch>
---

$ sudo ln -s /etc/apache2/sites-available/namadomain.com.conf /etc/apache2/sites-enable

Lihat videonya di sini -> https://youtu.be/IVqKbxpwc9k

Install SSL/HTTPS Sertificate

Sebelum install SSL certificate jalankan ini dulu supaya akses SSL tidak terblokir oleh firewall

$ sudo ufw allow 'Apache Secure'
$ sudo apt install certbot python3-certbot-apache
$ sudo certbot --apache -d namadomain.com -d www.namadomain.com

Lihat videonya di sini -> https://youtu.be/nDIUt_PU6jw

Buat Database Untuk WordPress

$sudo mysql
mysql> create database namadb;
mysql> CREATE USER 'pakarbot'@'localhost' IDENTIFIED BY 'pakarbot123';
mysql> GRANT ALL ON *.* TO 'pakarbot'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> show databases; <- untuk melihat db sudah berhasil dibuat atau belum

ctrl+d untuk keluar dari console mysql

Lihat videonya di sini -> https://youtu.be/jaXS6n_tgN8

Download Installer WordPress

$ cd /var/www/namadomain.com/
$ sudo wget http://wordpress.org/latest.zip
$ sudo apt-get install unzip
$ sudo unzip latest.zip
$ sudo mv -vf wordpress/* ./
$ sudo rm -rvf wordpress/

Lihat Videonya di sini -> https://youtu.be/wfns5lE4Aok

Konfigurasi wp-config.php

$ cd /var/www/namadomain.com
$ sudo cp wp-config-sample.php wp-config.php
$ sudo nano wp-config.php <- ubah db name,user, & pass

Akses dari browser namadomain.com atau https://namadomain.com/wp-admin/install.php

Lihat videonya di sini -> https://youtu.be/ZnjgarYDSxs

Install ekstensi-ekstensi tambahan

install mysql extension
# apt-get install php7.4-mysql

install php-xml extension
# sudo apt-get install php-xml

install curl
# sudo apt-get install php7.4-curl

tambahkan swap
lihat di sini https://pakarbot.com/member/content/p/id/30/

Penjelasan Step-step tambahan

+ Muncul error missing MySQL extension

Your PHP installation appears to be missing the MySQL extension which is required by WordPress

Jika muncul error seperti di atas artinya module mysql untuk php belum terinstall.

cek dulu apa sudah terinstall atau belum
# dpkg –list | grep php7.0-mysql

jika tidak ada maka install dulu
# apt-get install php7.0-mysql

+ Install plugin gagal (minta akses ke FTP)

/var/www/html# chown -R www-data:www-data ./*

buka file wp-config.php kemudian tambahkan baris ini tepat di bawah tulisan

/* Add any custom values between this line and the “stop editing” line. */

define (‘FS_METHOD’, ‘direct’); define (‘FS_CHMOD_DIR’, 0755); define (‘FS_CHMOD_FILE’, 0644);

lihat video di sini https://pakarbot.com/vps-mastery-tambahan-2-troubleshoot-gagal-install-plugintheme-di-wordpress/

+ curl belum terinstall

# dpkg –list | grep php7.0-curl
# sudo apt-get install php7.0-curl

+ wordpress permalink error 404

lihat video nya di sini

# chown -R www-data:www-data .htaccess
# chmod -R 666 .htaccess
# sudo a2enmod rewrite

setting apache
# sudo nano /etc/apache2/apache2.conf

kemudian cari baris script yang seperti ini

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

pastikan allowoverride nya all

+ connect ke jetpack tidak bisa, muncul error

The Jetpack server was unable to communicate with your site [HTTP 500]

# sudo apt-get install php-xml

Leave a Reply

Your email address will not be published. Required fields are marked *