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.

[INPUT]

1 2 apt update apt install mariadb-server

Memeriksa status service untuk MariaDB dengan nama service mariadb.

[INPUT]

1 systemctl status mariadb

Hasilnya.

[INPUT]

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.

[INPUT]

1 mysql_secure_installation

Jawab pertanyaan konfigurasi.

[INPUT]

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.

[INPUT]

1 mysql

Membuat database dan user untuk WordPress dengan nama blog.

[INPUT]

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.

[INPUT]

1 wget -O – http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash

Install OpenLiteSpeed.

[INPUT]

1 apt install openlitespeed

Memeriksa status service untuk OpenLiteSpeed dengan nama service lsws.

[INPUT]

1 systemctl status lsws

Hasilnya.

[INPUT]

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=/SUCCESS)

OpenLiteSpeed secara default berjalan di port 8088.

Browse *http://IP_SERVER:8088* untuk menguji hasil instalasi OpenLiteSpeed, apakah sudah dapat diakses.

OpenLiteSpeed default page

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.

[INPUT]

1 /usr/local/lsws/admin/misc/admpass.sh

Hasilnya.

[INPUT]

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.

OpenLiteSpeed WebAdmin console

*Install PHP*

Install PHP dan extension dari repository OpenLiteSpeed.

[INPUT]

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.

[INPUT]

1 ln -s /usr/local/lsws/lsphp74/bin/lsphp /usr/bin/php

Menguji command php.

[INPUT]

1 php -v

Hasilnya.

[INPUT]

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.

[INPUT]

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*.

Virtual Host list

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*.

Add Virtual Host

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:

[INPUT]

1 2 3 4 5 6 7 8 9 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]

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.

[INPUT]

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.

[INPUT]

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 · Email

Klik *Install WordPress*

Selamat mencoba 🙂

Leave a Reply

Your email address will not be published.