Auto Setup via scriptThis method will automatically set up Listener/VirtualHost/Force SSL/Let’s Encrypt/WordPress.Interactive mode
wget https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/vhsetup.sh chmod +x vhsetup.sh bash vhsetup.shOr just run the script without downloading it:
/bin/bash <( curl -sk https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/vhsetup.sh )CLI mode
wget https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/vhsetup.sh chmod +x vhsetup.sh bash vhsetup.sh -d www.example.com -le email@example.com -f -wOr just run the script without downloading it:
/bin/bash <( curl -sk https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/vhsetup.sh ) -d www.example.com -le firstname.lastname@example.org -f -w
- Please be sure that your domain is already pointing to the server when using
- Please be sure that your environment has php/sql service/sql root password when using
Manual SetupBy default, OpenLiteSpeed has an example virtual host already created. You can create more virtual hosts if you like. See Create Virtual Hosts on OpenLiteSpeed.
By default virtual hosts inherit the version of PHP that is set at the server level. You may wish to use a different PHP version for certain virtual hosts. Follow the steps below to set up virtual-host-level PHP. Here we will use the PHP version 7.4 as an example.
Install PHP 7.4 and commonly used PHP extensions:
apt-get install lsphp74 lsphp74-common lsphp74-curl lsphp74-imagick lsphp74-imap lsphp74-json lsphp74-memcached lsphp74-mysql lsphp74-opcache lsphp74-redis -y
Navigate to WebAdmin console > Server Configuration > External App > Add > Type > LiteSpeed SAPI App to set up a server-level external application. Set the following values:
- Max Connections:
- Initial Request Timeout (secs):
- Retry Timeout (secs):
Navigate to WebAdmin console > Virtual Hosts > your vhost > Script Handler > Add to add a virtual-host-level PHP handler. Set the following values:
- Handler Type:
- Handler Name:
OpenLiteSpeed come with php detached mode by default, so need to restart php with command
killall -9 lsphp to make settings take effect.
Some cloud providers like Google Cloud Platform may block port 25 by default to prevent SPAM email.
We can use a plugin, e.g. WP Mail SMTP, to set a specific port easily. Please see How to Set Up the Other SMTP Mailer in WP Mail SMTP for details.
Edit the following file to configure PHP parameters:
NOTE: We are using LSPHP 7.3 as example. If you are using a different version, please adjust the number in the URL accordingly. To increase the allowed file size, for example, you would make the following edits:
upload_max_filesize = 64M post_max_size = 64M
Other parameters in the file may also be changed, if needed. OpenLiteSpeed come with php detached mode by default, so need to restart php with command
killall -9 lsphp to make settings take effect
NOTE: You have the option of using the following WordPress plugin to edit PHP directly from WordPress without doing it manually like this.
The OpenLiteSpeed WordPress image comes with the latest phpMyAdmin version already, so you shouldn’t need to update it. If you do need to update it, you can run the following commands:
cd /var/www/; mv phpmyadmin phpmyadmin.bak wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip unzip phpMyAdmin-*.zip; rm -f phpMyAdmin-*.zip mv phpMyAdmin-* phpmyadmin cp phpmyadmin.bak/config.inc.php phpmyadmin chown -R www-data:www-data phpmyadmin
Method 1: Change phpMyAdmin URL
- Navigate to WebAdmin > Virtual Hosts > Context
- Change URI from
/phpmyadminto (for example)
Method 2: Allow specific IP only
- Navigate to WebAdmin > Virtual Hosts > Context > phpmyadmin
- Change Access Allowed from
*to (for example)
18.104.22.168and set Access Denied to
22.214.171.124 with your IPs/subnets
Method 3: Require a Password
- Log into SSH console and create a password file:
$ sudo touch /usr/local/lsws/conf/PASS $ sudo chown lsadm:lsadm /usr/local/lsws/conf/PASS
- Navigate to WebAdmin > Virtual Hosts > Security
- Click + under Realm List then set Realm Name =
example, and User DB Location =
/usr/local/lsws/conf/PASSto create a user/password
- Navigate to WebAdmin > Virtual Hosts > Context > phpmyadmin
- Set Realm to
For help learning how to connect to your VPS using SSH please see our Quick Start Guide on SSH using Putty.
- Log into phpMyAdmin
- Click the Operations tab
- Under the field Rename database to: enter the new database name.
- Click the Go button and press OK.
Run the following command:
Configure the settings as follows:
- General type of mail configuration?
- System mail name:
- Root and postmaster mail recipient:
ubuntu(your user name)
- Other destinations to accept mail for:
(to use default value)
- Force synchronous updates on mail queue?
- Local networks:
127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
- Mailbox size limit:
- Local address extension character:
- Internet protocols to use:
This is for OpenLiteSpeed VPS users only. Our shared hosting environments already have email server preinstalled. All you have to do is create email account in cPanel or Plesk.
yum -y install postfix
DEBIAN_FRONTEND=noninteractive apt-get -y \ -o Dpkg::Options::='--force-confdef' \ -o Dpkg::Options::='--force-confold' install postfix
You should not need to install the PageSpeed Module if the LiteSpeed Cache plugin for WordPress is already in use. Enabling both may degrade performance by 10% or more.
To install the module, please see the OpenLiteSpeed PageSpeed Module knowledgebase article.
Sometimes a system upgrade may cause the config file to be updated. The first thing you can do is to check user permissions.
The OpenLiteSpeed WordPress image comes with automatic certificate renewal by default in
/etc/cron.d/certbot. An example of the cron job is:
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew
Once you finish the Let’s Encrypt apply by prompt script, it will auto apply the server hook to the cronjob rule. An example of the cron job is:
0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(43200))' && certbot -q renew --deploy-hook "/usr/local/lsws/bin/lswsctrl restart"
This cron job is triggered twice every day to renew the certificate. The
certbot -q renew command will check if the certificate is expiring in the next 30 days. If it is, then certbot will auto renew the certificate quietly without generating output, and auto restart the web server by hook. If the certificate is not expiring, then no action will be performed. When renewing the certificate, the same information provided during certificate creation (such as email address, domain name, web server root path etc.) will be used.
Visit your website using Chrome. Navigate to Chrome menu > More tools > Developer tools > Network, or simply use the shortcut Ctrl+Shift+I to bring it up. The test page may contain many requests, but you can just click your main domain to check the header. You might see
X-LiteSpeed-Cache: miss or
X-LiteSpeed-Cache: hit. Normally the first visit to a page is a
miss, but subsequent visits should be a
This script will:
- Generate an Apache config file from OpenLiteSpeed config
- Uninstall OpenLiteSpeed
- Install LiteSpeed and read the Apache config file
/bin/bash <( curl -sk https://raw.githubusercontent.com/litespeedtech/ls-cloud-image/master/Setup/ols2ent.sh ) -L
You will need to purchase a LiteSpeed Enterprise license after upgrade. Lite Speed Enterprise license can be purchased from our store.
Do not run this script on a production server or critical site without running it on a test site first.
OpenLiteSpeed was installed from the LiteSpeed repository, so you can simply use the system update to update OpenLiteSpeed to the latest stable version.
$ sudo apt-get update && sudo apt-get upgrade openlitespeed -y
If you forget your password, you may run the following command to reset it:
It will ask for the WebAdmin username, which should be
admin. Then, enter your new password. You can use Putty to make ssh connection. Read our quick start tutorial on Putty to get started quickly.