Install OpenLiteSpeed on Ubuntu 20.04

Install web server OpenLiteSpeed pada Ubuntu 20.04

  • Download repository OpenLiteSpeed
root@OpenLiteSpeed:~/icmp# wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | sudo bash
  • Update Repository dan Install OpenLiteSpeed
root@OpenLiteSpeed:~/icmp# apt update && apt install openlitespeed -y
  • Install PHP 7.4
root@OpenLiteSpeed:~/icmp# apt install lsphp74-{common,curl,mysql,ldap,curl,intl,imagick,dev,imap,opcache,memcached,apcu,dev,redis,memcached,ldap}
root@OpenLiteSpeed:~/icmp# ln -sf /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5
  • Start service openlitespeed
root@OpenLiteSpeed:~/icmp# sudo /usr/local/lsws/bin/lswsctrl start
[OK] Send SIGUSR1 to 5147
  • Cek versi php
root@OpenLiteSpeed:~/icmp# php -v
PHP 7.4.3 (cli) (built: Oct 25 2021 18:20:54) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
  • Setting admin password OpenLiteSpeed
root@OpenLiteSpeed:~/icmp# sudo /usr/local/lsws/admin/misc/admpass.sh

Please specify the user name of administrator.
This is the user name required to login the administration Web interface.

User name [admin]: admin
Please specify the administrator's password.
This is the password required to login the administration Web interface.

Password: <masukan password>
Retype password: <masukan password>
Administrator's username/password is updated successfully!
  • Login ke dashboard admin OpenLiteSpeed dengan url: https://ip_address_server:7080
  • Default page OpenLiteSpeed url: http://ip_address_server:8088

Konfigurasi OpenLiteSpeed


  • Buat root directory untuk virtual host
root@OpenLiteSpeed:~/icmp# mkdir -p /usr/local/lsws/litespeed.rainui.cloud
  • Buat file index.php pada directory /usr/local/lsws/litespeed.rainui.cloud
root@OpenLiteSpeed:~/icmp# nano /usr/local/lsws/litespeed.rainui.cloud/index.php
<html>
<title>OpenLiteSpeed</title>
<body>
<h1><center>OpenLiteSpeed</h1>
<p><center>OpenLiteSpeed is a high-performance, lightweight, open source HTTP
   server edition of LiteSpeed Web Server Enterprise</p>
</body>
</html>

<?php
phpinfo();
?>

  • Menambahkan Virtual Host pada OpenLiteSpeed > Virtual Hosts > Add
  • Masukan virtual Host Name: (contoh) litespeed.rainui.cloud > Virtual Host Root: $SERVER_ROOT/litespeed.rainui.cloud/ > Config File: $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf > Follow Symbolic Link: Yes > Enable Scripts/ExtApps: Yes > Restrained: Yes > Save
  • Akan muncul error selah klik Save, karena file konfigurasi tidak ditemukan > Click To Create > Save > Restart service OpenLiteSpeed
  • Mengatur Root Directory untuk virtual host (litespeed.rainui.cloud) > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab General > General > Edit
  • Document Root: $VH_ROOT/ > Domain Name: litespeed.rainui.cloud > Domain Aliases: www.litespeed.rainui.cloud > Administrator Email: [email protected] > Enable GZIP Compression: Yes > Save
  • Mengatur Index file > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab General > Index Files > Edit > Use Server Index Files: No > Index Files: index.php, index.html, index.htm > Auto Index: No > Save
  • Mengatur Log file > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab Log > Virtual Host Log > Edit > Use Server’s Log: Yes > File Name: $VH_ROOT/error.log > Log Level: ERROR > Rolling Size (bytes): 10M > Save
  • Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab Log > Access Log > Add > Log Control: Own Log File > File Name: $VH_ROOT/access.log > Rolling Size (bytes): 10M > Keep Days: 30 > Save > Restart service OpenLiteSpeed
  • Mengatur akses control > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab Security > Access Control > Edit > Allowed List: * > Save
  • Mengatur script handlers > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab Script Handler > Script Handler Definition > Add > Suffixes: php > Handler Type: LiteSpeed SAPI > Handler Name: [Server Level]: lspsp > Save
  • Mengatur rewrite control > irtual Hosts > pilih litespeed.rainui.cloud (view) > Tab Rewrite > Rewrite Control > Edit > Enable Rewrite: Yes > Auto Load from .htaccess: Yes > Save > Restart service OpenLiteSpeed

  • Mengubah Listener Port dari port 8088 ke port 80
  • Listeners > pilih Default (view) > Tab General > Address Settings > Edit > Port: 80 > Save > Restart service OpenLiteSpeed
  • Menambahkan Virtual Host Mapping > Listeners > pilih Default (view) > Tab General > Virtual Host Mappings > Add > Virtual Host: litespeed.rainui.cloud > Domains: litespeed.rainui.cloud > Save > Restart service OpenLiteSpeed

  • Cek domain litespeed.rainui.cloud pada browser
  • Virtual host sudah berjalan dengan baik, tetapi untuk versi php yang di gunakan masih 7.3 (karena secara default OpenLiteSpeed menggunakan versi php 7.3)
  • Ganti versi php dari 7.3 ke 7.4 dengan edit file: /usr/local/lsws/conf/httpd_config.conf
  • cari baris lsphp73/bin/lsphp ganti degan lsphp74/bin/lsphp
  • Restart service openlitespeed: systemctl restart openlitespeed
  • Cek kembali pada browser akses domain litespeed.rainui.cloud, versi php sudah menggunakn versi 7.4

  • Menambahkan SSL/HTTPS Let’s Encrypt pada OpenLiteSpeed > install cerbot
root@OpenLiteSpeed:~/icmp# apt install certbot -y
  • Aktifkan/generate ssl pada domain litespeed.rainui.cloud
root@OpenLiteSpeed:~/icmp# certbot certonly --webroot -w /usr/local/lsws/litespeed.rainui.cloud -d litespeed.rainui.cloud
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: N
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for litespeed.rainui.cloud
Using the webroot path /usr/local/lsws/litespeed.rainui.cloud for all unmatched domains.
Waiting for verification...
Cleaning up challenges
IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/litespeed.rainui.cloud/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/litespeed.rainui.cloud/privkey.pem
   Your cert will expire on 2022-02-16. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot
   again. To non-interactively renew *all* of your certificates, run
   "certbot renew"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - If you like Certbot, please consider supporting our work by:
   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

  • Menambahkan Listener port 443 (https) > Listeners > Tab Summary > Listener Lists > Add
  • Listener Name: HTTPS > IP Address: ANY IPv4 > Port: 443 > Secure: Yes > Save > Restart service OpenLiteSpeed
  • Tambahkan Virtual Host Mappings pada Listerner Port 443 > Listeners > pilih HTTPS (view) > Virtual Host Mappings > Add > Virtual Host: litespeed.rainui.cloud > Domains: litespeed.rainui.cloud > Save
  • Pada Tab SSL yang ada pada Listener HTTPS > masukan lokasi file sertificate ssl > Private Key File: /etc/letsencrypt/live/litespeed.rainui.cloud/privkey.pem > Certificate File: /etc/letsencrypt/live/litespeed.rainui.cloud/cert.pem > Chained Certificate > Yes > Save Restart service OpenLiteSpeed
  • Masukan lokasi file ssl pada Virtual Hosts > Virtual Hosts > pilih litespeed.rainui.cloud (view) > Tab SSL > SSL Private Key & Certificate > Edit > Private Key File: /etc/letsencrypt/live/litespeed.rainui.cloud/privkey.pem > Certificate File: /etc/letsencrypt/live/litespeed.rainui.cloud/cert.pem > Chained Certificate > Yes > Save Restart service OpenLiteSpeed
  • Cek kembali pada browser akses domain dengan url: https://litespeed.rainui.cloud , domain sudah berhasil menggunakan ssl/https

herdiana3389

A system administrator with skills in system administration, virtualization, linux, windows, networking, cloud computing, container, etc.