X
    Categories Tutorials

Install WordPress with OpenLiteSpeed on Ubuntu 16.04

Today we will show you How to install and configure WordPress with OpenLiteSpeed on your Ubuntu 16.04 VPS. OpenLiteSpeed is a lightweight, open source HTTP server developed and copyrighted by LiteSpeed Technologies, Inc. It provides a user friendly web interface and supports various operating systems, including Linux, Mac OS, SunOS and FreeBSD.

It is fairly easy to install WordPress with OpenLiteSpeed on an Ubuntu 16.04 VPS. The installation process should take about 15-20 minutes if you follow the very easy steps described below.

INSTRUCTIONS:

First of all login to your Ubuntu 16.04 VPS via SSH as user root

ssh root@IP_address

At the very beginning, it is best to start a screen session by executing the following command

screen -U -S openlitespeed

Update the system:

apt-get update && apt-get -y upgrade

Make sure to always keep your server up to date.

Install MariaDB

To install MariaDB, run the following command:

apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

mysql_secure_installation

Configure it like this:

Enter current password for root (enter for none): Enter
Set root password? [Y/n]: Y
New password: 
Re-enter new 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

Next, we need to create a database for our WordPress installation.

[user]$ mysql -u root -p

MariaDB [(none)]> CREATE DATABASE wordpress;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'your-password';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Do not forget to replace ‘your-password’ with a strong password.

Install OLS

Download the OLS 1-click script on your server:

cd /opt
wget https://raw.githubusercontent.com/litespeedtech/ols1clk/master/ols1clk.sh

In order to run the script we need to make the file executable with the following command:

chmod +x ols1clk.sh

For this guide we are going to assume that you want to use PHP7 and install only OLS without WordPress being installed (We prefer to install wordpress separately). So lets run the following command:

./ols1clk.sh --lsphp 70

When the installation is complete, configure an administrative username and password for the OpenLiteSpeed’s web interface by running the following command:

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

You will be asked to provide a username for the administrative user. If you just press ENTER, the username “admin” will be selected. Afterwards, you will be asked to select and confirm a new password for the account.

Let’s verify OLS is up and running https://your-ip-address:7080. You should be able to log into OLS WebAdmin. Now lets get WordPress installed and then we will configure OLS.

Install WordPress

Lets move to the directory where we want to download the WordPress core files:

cd /usr/local/lsws/Example

Download WordPress using the wget command:

wget https://wordpress.org/latest.zip

Now we will unzip the WordPress zip file:

unzip latest.zip

Give permission of the entire directory structure to the user that the web server runs under so that changes can be made through the WordPress interface:

chown -R nobody:nogroup /usr/local/lsws/Example/wordpress/

Now lets go into the /wordpress directory:

cd wordpress

We are going to configure WordPress to work with our current database we setup earlier. First we will rename the wp-config-sample.php to wp-config.php using the following command:

mv wp-config-sample.php wp-config.php

Open the WordPress configuration file with your favorite text editor and change the database values with the ones you gave at the time of the database creation.

nano wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'your-password');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Configure OpenLiteSpeed

We will be modifying the default virtual host that is already present in the OpenLiteSpeed configuration so that we can use it for our WordPress installation.

First, login to the OLS WebAdmin panel at https://your-ip-address:7080.

Once logged in to the OLS WebAdmin select “Virtual Hosts” from the menu bar and click on the “View” link:

This will allow you to edit the configuration of your virtual host.

First we will change the Document root of the Virtual Host to point to our WordPress directory.

Click on the “General” tab for the virtual host and then click the “Edit” button for the “General” table:

In the “Document Root” field, change the value from $VH_ROOT/html/ to $VH_ROOT/wordpress/:

Click “Save” when you are finished.

Then, we will enable index.php files so that they can be used to process requests that aren’t handled by static files. This will allow the main logic of WordPress to function correctly.

Click the “Edit” button for the “Index Files” table:

In the field for valid “Index Files”, add index.php before index.html to allow PHP index files to take precedence:

Click “Save” when you are finished.

Configure WordPress Rewrites to Enable Permalink Support

Next, we will set up the rewrite instructions so that we can use permalinks within our WordPress installation.

To do so, click on the “Rewrite” tab for the virtual host. In the next screen, click on the “Edit” button for the “Rewrite Control” table:

Select “Yes” under the “Enable Rewrite” option:

Click “Save” to go back to the main rewrite menu. Click on the “Edit” button for the “Rewrite Rules” table:

Remove the rules that are already present and add the following rules to enable rewrites for WordPress:

Click on the “Save” button to implement your new rewrite rules.

The next thing that we need to do is to change the default listening port from 8088 to 80.

Select “Listeners” from the menu bar and click on the “View” link:

Next, click on the “Edit” button for the “Address Settings” table:

In the Port field, change the port number from 8088 to 80:

Click “Save” when you are finished.

Restart the Server to Implement the Changes

With all of the above configuration out of the way, we can now gracefully restart the OpenLiteSpeed server to enable our changes.

Finish the Installation Through the WordPress Interface

Now you can finish your WordPress installation by opening your favorite web browser and navigate to:

http://your-domain-name.com/

Installing WordPress and OpenLiteSpeed is an easy task if you have a Managed WordPress Hosting with us. Feel free to ask our expert Linux Administrators to install these for you, and it will be taken care of immediately. They are available 24×7, so you can get the help you need at any time.

P.S. Feel free to share this blog post if you liked it by using the social network shortcuts – you can also leave a comment instead, found under the share buttons.

admin :

View Comments (3)