Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Today we are going to show you how to install and configure WordPress with OpenLiteSpeed ​​on your Ubuntu 16.04 VPS. OpenLiteSpeed ​​is an open source lightweight HTTP server developed and protected by LiteSpeed ​​Technologies, Inc. It provides a user-friendly web interface and supports a variety of operating systems including Linux, Mac OS, SunOS, and FreeBSD.

It’s pretty easy to install WordPress with OpenLiteSpeed ​​on an Ubuntu 16.04 VPS. The installation process takes about 15-20 minutes if you follow the very simple steps below.

INSTRUCTIONS:

First of all, login to your Ubuntu 16.04 VPS via SSH as superuser

ssh [email protected]_address

At the very beginning, start a screen session by running 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.

Installing 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 the installation:

mysql_secure_installation

Set it up 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 'ваш-пароль';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> q

Remember to replace “your-password” with a strong password.

Install OLS

Download the OLS script in 1-click to the 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 tutorial, we will assume that you want to use PHP 7 and only install OLS without WordPress (We prefer to install WordPress separately). Thus, we will run the following command:

./ols1clk.sh --lsphp 70

When the installation is complete, set up an administrative username and password for the OpenLiteSpeed ​​web interface by running the following command:

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

You will be prompted for a username for a user with administrator rights. If you just press ENTER, the username “admin” will be selected. You will then be prompted to select and confirm a new password for your account.

Let’s check if OLS is working and open https: // your-IP-address: 7080. You should be able to log into OLS WebAdmin. Now let’s have WordPress installed and then we’ll set up OLS.

Installing WordPress

Let’s go to the directory where we want to upload the main WordPress files:

cd /usr/local/lsws/Example

Download WordPress using wget command:

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

Now unzip the WordPress archive:

unzip latest.zip

Give permissions for the entire user directory structure under which the web server is running and can be done through the WordPress interface:

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

Now, let’s go to the WordPress directory:

cd wordpress

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

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

Open the WordPress config file with your favorite text editor and change the database values ​​to the ones you gave when creating the database.

nano wp-config.php
// ** Настройки MySQL - Вы можете получить эту информацию от вашего веб-хостинга ** //
/ ** Имя базы данных для WordPress * /
define('DB_NAME', 'Wordpress');

/ ** имя пользователя базы данных MySQL * /
define('DB_User', 'wordpressuser');

/ ** пароль базы данных MySQL * /
define('DB_PASSWORD', 'ваш-пароль');

/ ** MySQL имя хоста * /
define('DB_HOST', 'LOCALHOST');

Setting up 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, log into the OLS WebAdmin panel at https: // your-ip-address: 7080.

After logging into OLS WebAdmin, select “Virtual Hosts” in the menu bar and click on the “View” button:

This will allow you to change your virtual host configuration.

First, we’ll change the virtual host’s document root 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:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

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

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Click the Save button when you’re done.

We will include the index.php file so that it can be used to process requests that do not handle static files. This will allow the core WordPress logic to function properly.

Click on the “Edit” button for the “File List” table:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

In the field for “Index Files”, add index.php to index.html before allowing PHP files to be indexed:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Click the Save button when you’re done.

Setting up WordPress, enabling link rewriting

Next, we’ll create a rewrite instruction so that we can use permalinks in our WordPress installation.

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

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

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

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Click the Save button to return to the main overwrite menu. Click on the “Edit” button for the “Rewriting rules” table:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Remove the rules that are already present and add the following rules to allow overwriting for WordPress:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

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

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

Select “Listeners” in the menu bar and click on the “View” button:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Then click on the “Edit” button for the “Address settings” table:

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

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

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Click the Save button when you’re done.

Restart the server for the changes to take effect

With all the configurations in place, we can now gracefully restart the OpenLiteSpeed ​​server for our changes to take effect.

Installing WordPress with OpenLiteSpeed ​​on Ubuntu 16.04

Completing the installation via the WordPress interface

You can now complete the WordPress installation by opening your favorite web browser and following the link:

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

Sidebar