How To Install WordPress with OpenLiteSpeed on Ubuntu 18.04 | DigitalOcean

How To Install WordPress with OpenLiteSpeed on Ubuntu 18.04 | DigitalOcean

How To Set Up the code-server Cloud IDE Platform on Ubuntu 18.04

How To Configure a Galera Cluster with MySQL on Ubuntu 18.04 Servers

WordPress is an open-source content management system (CMS). The most popular CMS in the world, WordPress allows you to set up blogs and websites on top of a MySQL database backend, using PHP to execute scripts and process dynamic content.

OpenLiteSpeed is an optimized open-source web server that you can use to manage and serve websites. OpenLiteSpeed has some useful features that make it a solid choice for many installations: Apache-compatible rewrite rules, a built-in web-based administration interface, and customized PHP processing optimized for the server.

This guide will walk through the process of installing and setting up a WordPress instance on Ubuntu 18.04 using the OpenLiteSpeed web server. Because both WordPress and OpenLiteSpeed can be administered through a web browser, this configuration is ideal for those who do not have regular access to an SSH session or those who may not feel comfortable managing a web server via the command line.

Before you begin this guide, you will need the following:

WordPress uses MySQL to manage and store site and user information. You already have MySQL installed, but as a preparatory step you need to make a database and a user for WordPress to use.

To get started, connect to your server using SSH:

Then log in to the root MySQL account:

From the MySQL prompt, create a database with the following command. Here, we will name this database to keep things simple, but you can name it whatever you’d like:

Then, create a user and grant it privileges over the database you just created. Again, you can give this user any name, but for simplicity we will name it . Also, be sure to change to a strong password of your own choosing:

Then, run which tells the server to reload the grant tables and put your new changes into effect:

Following that, you can close the MySQL prompt:

You’re done setting up your MySQL installation to work with WordPress. Next, we will install a few PHP extensions.

In the prerequisite OpenLiteSpeed tutorial, you installed the package. This is a compilation of PHP optimized for OpenLiteSpeed which uses the LiteSpeed SAPI to communicate with external applications. Depending on your needs, WordPress may require other certain PHP extensions in order to function as desired.

To install some PHP extensions commonly used with WordPress, run the following command:

Note: The packages in this command may not cover every use case. For a full list of the PHP 7.3 extensions available from the LiteSpeed repository you added to your server in the prerequisite tutorial, see the LiteSpeed Wiki.

Following this, you can move on to downloading and setting up WordPress on your server.

Now that your server software is configured, you can install and set up WordPress. For security reasons in particular, it is always recommended that you get the latest version of WordPress directly from their site.

Change into a writable directory and then download the compressed release by typing:

Extract the compressed file to create the WordPress directory structure:

We will move these files into our document root momentarily, but first we will create a few files and directories that the WordPress installation will depend on.

OpenLiteSpeed supports .htaccess files. This is important for our purposes, since WordPress uses files to create and manage permalinks.

Add a dummy file so that it will be available for WordPress to use later:

Next, copy over the sample configuration file to the filename that WordPress actually reads:

Additionally, create the directory so that WordPress won’t run into permissions issues when trying to do this on its own following an update to its software:

Then, copy the entire contents of the directory into your document root. OpenLiteSpeed comes with a default virtual host named located in the directory. The document root for the virtual host is the subdirectory:

Notice that this command includes a dot at the end of the source directory to indicate that everything within the directory should be copied, including hidden files (like the file you created):

With that, you’ve successfully installed WordPress onto your web server and performed some of the initial configuration steps. Next, we’ll go through some further configuration changes that will give WordPress the privileges it needs to function securely and access the MySQL database and user account you created previously.

Before we can go through the web-based setup process for WordPress, we need to adjust some items in our WordPress directory.

Start by giving ownership of all the files in the directory to the nobody user and the nogroup group, which the OpenLiteSpeed web server runs as by default. The following command will grant OpenLiteSpeed the ability to read and write files in the directory, allowing it to serve the website and perform automatic updates:

Next run two commands to set the correct permissions on the WordPress directories and files:

These should be a reasonable permissions set to start with, although some plugins and procedures might require additional tweaks.

Following this, you will need to make some changes to the main WordPress configuration file.

When you open the file, your first objective will be to adjust some secret keys to provide some security for your installation. WordPress provides a secure generator for these values so that you do not have to try to come up with good values on your own. These are only used internally, so it doesn’t hurt usability to have complex, secure values here.

To grab secure values from the WordPress secret key generator, type:

You will get back unique values that look something like this:

Warning! It is important that you request unique values each time. Do NOT copy the values shown below!

Images Powered by Shutterstock