Cara Install WordPress dengan OpenLiteSpeed di Ubuntu 20.04
OpenLiteSpeed adalah web server versi open source dari LiteSpeed Enterprise. Sama seperti versi enterprise, OpenLiteSpeed dikembangkan dan dimaintain oleh tim yang sama. OpenLiteSpeed memiliki semua fitur penting yang terdapat di LiteSpeed Enterprise.
OpenLiteSpeed mendukung untuk menjalankan website WordPress. Pengujian perbandingan kinerja web server OpenLiteSpeed vs Nginx vs Apache yang menjalankan WordPress, hasilnya menunjukkan bahwa waktu respon dari OpenLiteSPeed jauh lebih cepat jika dibandingkan dengan web server lain, sehingga dapat melayani request lebih banyak.
Tutorial Environment
Environment yang digunakan di tutorial ini:
- OS Ubuntu 20.04
- MariaDB database
- OpenLiteSpeed 1.7.15
- PHP 7.4 OpenLiteSpeed
- WordPress 5.9
- SSL Cloudflare
- Domain musaamin.my.id
Install MariaDB
Install MariaDB database.
1 2 | apt update apt install mariadb-server |
Memeriksa status service untuk MariaDB dengan nama service mariadb.
1 | systemctl status mariadb |
Hasilnya.
1 2 3 4 5 | ● mariadb.service - MariaDB 10.3.34 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-03-03 07:15:45 WIB; 13s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ |
Mengamankan instalasi MariaDB.
1 | mysql_secure_installation |
Jawab pertanyaan konfigurasi.
1 2 3 4 5 6 7 8 | Enter current password for root (enter for none): ENTER Set root password? [Y/n] ENTER New password: MASUKKAN_PASSWORD_UNTUK_root_DATABASE Re-enter new password: MASUKKAN_PASSWORD_UNTUK_root_DATABASE Remove anonymous users? [Y/n] ENTER Disallow root login remotely? [Y/n] ENTER Remove test database and access to it? [Y/n] ENTER Reload privilege tables now? [Y/n] ENTER |
Login ke MariaDB.
1 | mysql |
Membuat database dan user untuk WordPress dengan nama blog.
1 2 3 4 | CREATE DATABASE blog; GRANT ALL PRIVILEGES ON blog.* TO 'blog'@'localhost' IDENTIFIED BY 'rahasia'; FLUSH PRIVILEGES; exit |
Install OpenLiteSpeed
Memasang repository untuk OpenLiteSpeed.
1 | wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash |
Install OpenLiteSpeed.
1 | apt install openlitespeed |
Memeriksa status service untuk OpenLiteSpeed dengan nama service lsws.
1 | systemctl status lsws |
Hasilnya.
1 2 3 4 | ● lshttpd.service - OpenLiteSpeed HTTP Server Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2022-03-03 07:12:47 WIB; 15s ago Process: 4609 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS) |
OpenLiteSpeed secara default berjalan di port 8088.
Browse http://IP_SERVER:8088 untuk menguji hasil instalasi OpenLiteSpeed, apakah sudah dapat diakses.
Default SERVER_ROOT folder berada di /usr/local/lsws.
Halaman default yang ditampilkan berasal dari file /usr/local/lsws/Example/html/index.html.
OpenLiteSpeed memiliki WebAdmin sebagai user interface untuk konfigurasi, berjalan di port 7080.
Mengubah password user admin untuk WebAdmin.
1 | /usr/local/lsws/admin/misc/admpass.sh |
Hasilnya.
1 2 3 4 5 6 7 8 9 10 11 | Please specify the user name of administrator. This is the user name required to login the administration Web interface. User name [admin]: ENTER Please specify the administrator's password. This is the password required to login the administration Web interface. Password: MASUKKAN_PASSWORD Retype password: MASUKKAN_PASSWORD Administrator's username/password is updated successfully! |
Browse http://IP_SERVER:7080, login dengan username = admin, passwword = yang diatur sebelumnya.
Install PHP
Install PHP dan extension dari repository OpenLiteSpeed.
1 | apt install lsphp74 lsphp74-common lsphp74-imagick lsphp74-intl lsphp74-mysql lsphp74-json lsphp74-curl lsphp74-tidy lsphp74-imap lsphp74-opcache |
Membuat symbolic link untuk command php.
1 | ln -s /usr/local/lsws/lsphp74/bin/lsphp /usr/bin/php |
Menguji command php.
1 | php -v |
Hasilnya.
1 2 3 4 | PHP 7.4.28 (litespeed) (built: Feb 17 2022 14:53:51) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies |
Konfigurasi Virtual Host
Membuat folder untuk virtual host musaamin.my.id.
1 2 3 4 | cd /usr/local/lsws mkdir musaamin.my.id mkdir musaamin.my.id/{conf,html,logs} chown lsadm:lsadm musaamin.my.id/conf |
Login ke WebAdmin http://IP_SERVER:7080.
Menu Virtual Hosts > Add.
Masukkan:
- Virtual Host Name: musaamin.my.id
- Virtual Host Root: $SERVER_ROOT/$VH_NAME
- Config File: $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
- Enable Scripts/ExtApps: Yes
- Restrained: Yes
Lalu klik Save.
Terjadi error file /usr/local/lsws/conf/vhosts/musaamin.my.id/vhconf.conf does not exist karena belum ada file konfigurasinya.
Klik CLICK TO CREATE.
Jika berhasil membuat file konfigurasi, tampil pesan /usr/local/lsws/conf/vhosts/musaamin.my.id/vhconf.conf has been created successfully.
Klik Save.
Klik View virtual host musaamin.my.id.
Klik tab General, lalu General – Edit.
Masukkan:
- Document Root: $VH_ROOT/html
- Enable GZIP Compression: Yes
- Enable Brotli Compression: Yes
- Save
Klik Index Files – Edit.
Masukkan:
- Use Server Index Files: No
- Index Files: index.php
- Auto Index: No
- Save
Tab Log, Virtual Host Log – Edit.
Masukkan:
- Use Server’s Log: Yes
- File Name: $VH_ROOT/logs/error.log
- Log Level: ERROR
- Rolling Size (bytes): 10M
- Save
Tab External App, klik Add.
Pilih Type: LiteSpeed SAPI App, lalu Next.
Masukkan:
- Name: php74-musaamin.my.id
- Address: UDS://tmp/lshttpd/php74-musaamin.my.id.sock
- Max Connections: 10
- Initial Request Timeout (secs): 60
- Retry Timeout (secs): 10
- Command: /usr/local/lsws/lsphp74/bin/lsphp
- Save
Tab Script Handler, lalu Add.
Masukkan:
- Suffixes: php
- Handler Type: LiteSpeed SAPI
- Handler Name: [VHost Level]: php74-musaamin.web.id
- Save
Tab Rewrite, Rewrite Control – Edit.
Masukkan:
- Enable Rewrite: Yes
- Auto Load from .htaccess: Yes
- Log Level: 0
- Save
Klik Rewrite Rules – Edit
Masukkan:
1 2 3 4 5 6 7 8 9 | <IfModule mod_rewrite.c> RewriteEngine On RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> |
Lalu Save.
Konfigurasi Listener HTTP
Klik menu Listeners, lalu Add.
Masukkan:
- Listener Name: http-musaamin.my.id
- IP Address: ANY IPv4
- Port: 80
- Secure: No
- Save
Klik View listener http-musaamin.my.id.
Klik Virtual Host Mappings – Add.
Masukkan:
- Virtual Host: musaamin.my.id
- Domains: musaamin.my.id, www.musaamin.my.id
- Save
Konfigurasi Listener HTTPS
Sebelumnya sudah tersimpan certificate dan private key SSL di server.
- Private Key File: /etc/ssl/musaamin.my.id/key.pem
- Certificate File: /etc/ssl/musaamin.my.id/cert.pem
Membuat Listener untuk HTTPS, klik menu Listeners, lalu Add.
Masukkan:
- Listener Name: https-musaamin.my.id
- IP Address: ANY IPv4
- Port: 443
- Secure: Yes
- Save
Klik View listener https-musaamin.my.id.
Klik Add di Virtual Host Mappings.
Masukkan:
- Virtual Host: musaamin.my.id
- Domains: musaamin.my.id, www.musaamin.my.id
- Save
Tab SSL, klik SSL Private Key & Certificate – Edit.
Masukkan:
- Private Key File: /etc/ssl/musaamin.my.id/key.pem
- Certificate File: /etc/ssl/musaamin.my.id/cert.pem
- Save
Klik Restart Service OpenLiteSpeed.
Install WordPress
Download WordPress.
1 2 | cd wget https://wordpress.org/latest.tar.gz -O wordpress.tar.gz |
Extract dan copy file WordPress ke folder html virtual host root.
1 2 3 | tar xzvf wordpress.tar.gz cp -Rv wordpress/* /usr/local/lsws/musaamin.my.id/html chown -R nobody:nogroup /usr/local/lsws/musaamin.my.id/html |
Browse https://musaamin.my.id, klik Continue.
Klik Let’s go!.
Masukkan:
- Database Name: blog
- Username: blog
- Password: rahasia
Klik Submit
Klik Run the installation
Masukkan:
- Site Title
- Username
- Password
Klik Install WordPress
Selamat mencoba 🙂
Pake Tutorial ini, gak ada file manager-nya ya?
tidak ada
Kalo untuk merubah domain bagaimana ya pak? misal domain A diganti ke domain B
coba bikin virtual host yang baru, copy datanya ke virtual host baru, dan ubah semua url dari domain lama ke domain baru di database
kalau boleh tau, website mimin menggunakan ubuntu/centos dan pakai apache/nginx ya?
Ubuntu 20.04, Nginx 1.22, PHP 7.4, MariaDB 10.5
HTTPS nya tidak bisa diakses kenapa ya? (took too long to respond)
cek firewall, dan konfigurasi SSL (HTTPS)
kalo untuk instal php 8.1 apakah: apt install lsphp74 lsphp74-common lsphp74-imagick lsphp74-intl lsphp74-mysql lsphp74-json lsphp74-curl lsphp74-tidy lsphp74-imap lsphp74-opcache digganti 81 aja? untuk angka 74 diganti 81?
Terima kasih
yes, ganti saja nomor versinya
Kok Unable to locate package lsphp81-json ya miun lalo pake php 81?
cari paketnya ‘apt-cache search lsphp’
coba pasang repository OpenLiteSpeed pakai perintah ini
sudo wget -O - https://repo.litespeed.sh | sudo bash
All Good, Terima kasih banyak min, sehat selalu