Install WordPress on Ubuntu 16.04 LTS with OpenLiteSpeed, MariaDB and PHP 7.1 Support

Majority of the webmasters online today will install WordPress with either Apache2 or Nginx HTTP servers… However, HTTP servers like OpenLiteSpeed and Lighttpd can also provide performance benefits for your WordPress content..
This brief tutorial shows students and new users how to install WordPress on Ubuntu 16.04 LTS with OpenLiteSpeed, MariaDB and PHP 7.1 support. If you haven’t heard of OpenLiteSpeed, is an open source web server developed by LiteSpeed Technology. It’s designed to be lightweight with a user friendly web interface to create and manage your websites.
You will learn how to install OpenLiteSpeed with MariaDB and PHP 7.1… and how to configure OpenLiteSpeed to allow WordPress to work. When you’re ready, continue with the steps below:
Step 1: Update the Ubuntu
It’s always good to update Ubuntu server prior to installing new packages… to update Ubuntu, run the commands below
sudo apt update && sudo apt dist-upgrade && sudo apt autoremove
Step 2: Install OpenLiteSpeed Dependencies
After updating the server, install the packages below to install required dependencies for OpenLiteSpeed.
sudo apt install build-essential libexpat1-dev libgeoip-dev libpcre3-dev zlib1g-dev libssl-dev libxml2-dev rcs libpng-dev
Step 3: Download and Install OpenLiteSpeed
Now that all dependencies are installed, go and fetch the latest version of OpenLiteSpeed. The commands below will download version 1.4.27 to your server..
cd /tmp/ && wget http://open.litespeedtech.com/packages/openlitespeed-1.4.27.tgz
Next, run the commands below to extract the downloaded package.
tar -xvzf openlitespeed-1.4.27.tgz
Change into the directory extracted directory
cd openlitespeed-1.4.27/
Then run the commands below to install OpenLiteSpeed.
sudo ./configure sudo make sudo make install
After that OpenLiteSpeed should be installed and ready to use.
Step 4: Configure OpenLiteSpeed
Finally, configure the administrative password for the web interface. Run the commands below to do that.
sudo /usr/local/lsws/admin/misc/admpass.sh
Then create a web admin username and password.
Please specify the user name of administrator. This is the user name required to login the administration Web interface. User name [admin]: openlite Please specify the administrator's password. This is the password required to login the administration Web interface. Password: new_password Retype password: retype_password Administrator's username/password is updated successfully!
After that, run the commands below to start the webserver.
sudo /etc/init.d/lsws start
Open your browser and browse to the server IP or hostname followed by 8088 to view the default page page.

To access the admin backend portal, use the port 7078

Step 5: Install MariaDB Database Server
To install MariaDB server run the commands below.
sudo apt-get install mariadb-server mariadb-client
After installing, the commands below can be used to stop, start and enable MariaDB service to always start up when the server boots.
sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service
After that, run the commands below to secure MariaDB server.
sudo mysql_secure_installation
When prompted, answer the questions below by following the guide.
- Enter current password for root (enter for none): Just press the Enter
- Set root password? [Y/n]: Y
- New password: Enter password
- Re-enter new password: Repeat password
- Remove anonymous users? [Y/n]: Y
- Disallow root login remotely? [Y/n]: Y
- Remove test database and access to it? [Y/n]: Y
- Reload privilege tables now? [Y/n]: Y
Restart MariaDB server
sudo systemctl restart mysql.service
Step 6: Create WordPress Database
WordPress needs a database… to create one, continue below..
Run the commands below to logon to the database server. When prompted for a password, type the root password you created above.
sudo mysql -u root -p
Then create a blank database called WP_database you can use the same database name from the old server.
CREATE DATABASE WP_database;
Create a database user called wp_user with new password. You can use the same username and password from the old server.
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'type_password_here';
Then grant the user full access to the database.
GRANT ALL ON WP_database.* TO 'wp_user'@'localhost' IDENTIFIED BY 'type_user_password_here' WITH GRANT OPTION;
Finally, save your changes and exit.
FLUSH PRIVILEGES; EXIT;
Step 7: Install PHP and Modules
PHP is required to allow WordPress to function….. run the commands below to add OpenLiteSpeed repository to your system…
sudo bash wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debain_repo.sh | bash
After adding the repository, run the commands PHP 7.1 and related modules..
sudo apt install lsphp71 lsphp71-common lsphp71-mysql lsphp71-tidy lsphp71-recode lsphp71-recode lsphp71-opcache
Next, run the commands below to create a symbolic link for PHP 7.1
sudo ln -sf /usr/local/lsws/lsphp71/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp7
Step 8: Install WordPress
Now that OpenLiteSpeed is up, go and download WordPress content. To do that, run the commands below… you will download, extract and copy WordPress content to OpenLiteSpeed default document root.. The default Virtual Host Root is at /usr/local/lsws/Example
cd /tmp && wget https://wordpress.org/latest.tar.gz tar -zxvf latest.tar.gz sudo mv wordpress /usr/local/lsws/Example/wordpress
Then run the commands below to set the correct permissions for WordPress root directory.
sudo chown -R nobody:nogroup /usr/local/lsws/Example/wordpress/ sudo chmod -R 755 /usr/local/lsws/Example/wordpress/
STEP 9: CONFIGURE WORDPRESS
Next, run the commands below to create WordPress wp-config.php file. This is the default configuration file for WordPress.
sudo mv /usr/local/lsws/Example/wordpress/wp-config-sample.php /usr/local/lsws/Example/wordpress/wp-config.php
Then run the commands below to open WordPress configuration file.
sudo nano /usr/local/lsws/Example/wordpress/wp-config.php
Enter the highlighted text below that you created for your database and save.
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'WP_database'); /** MySQL database username */ define('DB_USER', 'wp_user'); /** MySQL database password */ define('DB_PASSWORD', 'new_password_here'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');
Save the file and you’re done.
After that, open your browser and browse to OpenLiteSpeed backend portal..
Go to the Dashboard and select Server Configuration ==> External App… then click Edit as shown in the image below…

Then scroll to Command, then change the command to reflect the symbolic link created above for PHP 7.1 and save.
$SERVER_ROOT/fcgi-bin/lsphp7

Next, go to Virtual Hosts ==> View to edit the current VirtualHost settings..

When the settings page opens, click the General tab and edit the Document Root location.. to where we installed our WordPress content in the wordpress folder…
$VH_ROOT/wordpress/

On the same General tab, edit the Index File section and replace index.html with index.php shown below…. save the exit.

Next, go to Virtual Hosts ==> Rewrite and edit it… then turn on Rewrite Control to Yes

Next edit the Rweire Rules and replace the code with the one below, then save and exit..
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]

Finally, click on the Listeners from the left menu, then edit to change the current port from 8088 to 80. Save after that.

If you can’t get WordPress default page show, go to Virtual Hosts ==> Context… then delete the /protected/ URL in the list below.. Restart the server and try again..

After restarting, open your browser and browse to the server hostname or IP address and you should see WordPress setup wizard.

Continue with the wizard until you’ve successfully configure WordPress.
Enjoy!
You may also like the post below:
Thanks for the Guides.
Can you write a Guide for Installing Litespeed and WordPress?
Litespeed is free for a single site owner.
Works like charm. Thank you.