This tutorial will show you how to set up WordPress with OpenLiteSpeed web server on Ubuntu or Debian.
Now access administrative web interface and change port from 8088 to default HTTP port 80:
In the list of listeners, click the “View/Edit” button for the Default listener:
This will load a page with more details about the Default listener. Click the edit button in the top-right corner of the “Address Settings” table to modify its values:
On the next screen, change port 8088 to port 80, then click the floppy disk icon, Save:
After the modification, you will need to restart the server. Click the “reload” arrow icon to restart OpenLiteSpeed:
Prerequisites
You will need one (physical or virtual) machine installed with Ubuntu or Debian having sudo non-root user privileges.Set Timezone
Type the following command to correct your Ubuntu server's timezone.Adding OpenLiteSpeed Repository
OpenLiteSpeed provides a repository for its software you can use with Ubuntu’s standard apt command to install:Installing Ubuntu 19 Dependencies
You will need to perform this particular section only if you are running Ubuntu 19. If you are on Ubuntu 18.04, you can safely skip this and move to next step.
Installing OpenLiteSpeed
You can install OpenLiteSpeed web server by typing the following command:Setting the Administrative Password
By default, the password is set to 123456, so you should change this immediately. You can do this by running a script provided by OpenLiteSpeed:Updating Firewall Rules
You need to open up these two ports on firewall to allow access.Now access administrative web interface and change port from 8088 to default HTTP port 80:
Open up your favorite web browser and navigate to https://server_name_or_IP:7080 and login with username and password you created with admpass.sh script in earlier step.
Click Listeners in the list of options on the left side of the interface. A list of all available listeners will load.
This will load a page with more details about the Default listener. Click the edit button in the top-right corner of the “Address Settings” table to modify its values:
On the next screen, change port 8088 to port 80, then click the floppy disk icon, Save:
After the modification, you will need to restart the server. Click the “reload” arrow icon to restart OpenLiteSpeed:
Installing MySQL
First, install MySQL database and afterwards run the mysql_secure_installation script and follow the on screen instruction to secure it:Creating Database for WordPress
Now you need to create a user and database with the following command. For this guide, we will name this database wordpress to keep things simple and easy to remember, but you can name it whatever you’d like:
Installing PHP Dependencies
You will need to install some of these additional PHP extensions commonly used with WordPress:Downloading WordPress
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.
Configuring WordPress
Before we can go through the web-based setup process for WordPress, we need to adjust some items in our WordPress directory.
You will receive the output like below, copy the output you received to your clipboard,
and then open the WordPress configuration file located in your document root:
Find the section that contains the dummy values for those settings. It will look something like this:
Delete these lines and paste values you copied from the command line in the same section.
Next, modify the database connection settings at the top of the file. You need to adjust the database name, database user, and the associated password that you configured within MySQL.
The other change you must make is to set the define('FS_METHOD', 'direct'); that WordPress should use to write to the file-system. Failure to set this parameter would result in WordPress prompting for FTP credentials when you perform certain actions.
This parameter can be added below the database connection settings.
Save and close the file when you are finished.
Configuring OpenLiteSpeed
In this step, you’ll access the OpenLiteSpeed administrative interface and make a few changes to your server’s configuration.
Open up your favorite web browser, navigate to the OpenLiteSpeed administrative interface:
http://server_name_or_IP:7080 and log in with the username admin and password you set up with adminpass.sh script.
From the OpenLiteSpeed console, find and click on Server Configuration in the left-hand sidebar menu. Then navigate to the External App tab, find the row of the LiteSpeed SAPI App, and click on its Edit button:
You installed the lsphp73 package, a compilation of PHP optimized to work with OpenLiteSpeed through the LiteSpeed SAPI. However, the default settings in the External App page point to lsphp rather than lsphp73. Due to this, your OpenLiteSpeed installation won’t be able to correctly execute PHP scripts.
To correct this, change the Name field to lsphp73, change the Address field to uds://tmp/lshttpd/lsphp73.sock, and change the Command field to read $SERVER_ROOT/lsphp73/bin/lsphp:
After making those changes, click on the Save icon in the upper right-hand corner of the LiteSpeed SAPI App box.
Next, click on Virtual Hosts in the left-hand menu. On the Virtual Hosts page, find the virtual host you plan to use and click on its View icon. For this guide, we’ll use the default Example virtual host:
Navigate to the virtual host’s General tab. There, find the General section, and click on its Edit button:
All of your WordPress content and files are stored in the wordpress directory you created earlier, update the Document Root field to point to that directory. To do this, all you need to do is append wordpress/ to the end of the default value:
Click the Save icon to save this change.
While still in the General tab, scroll down to find the Index Files section and click on its Edit icon:
In the Index Files field, precede index.html with index.php and after updating this field, it will look like below:
Click the Save icon before continuing.
Next, navigate to the virtual host’s Rewrite tab. Find the Rewrite Control section and press the Edit button:
Set both the Enable Rewrite and Auto Load from .htaccess options to Yes by clicking the respective radial buttons. Configuring rewrite instructions in this fashion will allow you to use permalinks within your WordPress installation:
Click the Save icon after making those changes.
Now click on the Security tab, and then click the Delete button next to SampleProtectedArea within the Realms List table:
You will be asked to confirm the deletion. Click Delete to proceed.
Next, click on the Context tab. In the Context List, delete the /protected/ context that was associated with the security realm you just deleted:
Again, you will have to confirm the deletion by clicking Delete.
Now, press the green Graceful Restart icon in the upper-right corner of the OpenLiteSpeed console. This will restart the OpenLiteSpeed server, taking the changes we’ve made into effect:
Now, you’re ready to setup WordPress in your browser.
Finishing the WordPress Installation
Open up your favorite i.e. Firefox, Chrome web browser, navigate to your server’s name or IP address:
http://server_name_or_IP and select the language if it ask you would like to use:
Next, you will see the main setup page. Select a name for your WordPress site and choose a username. A strong password is generated automatically. Save this password or select an alternative strong password.
Enter your email address and select whether you want to discourage search engines from indexing your site:
When ready, click the Install WordPress button. You’ll be taken to a page that prompts you to log in:
Enter your username and password to log in
Once you log in, you will be taken to the WordPress administration dashboard:
From the dashboard, you can begin making changes to your site’s theme and publishing content.
Wrapping Up
By completing this tutorial, you installed and configured a WordPress instance on a Ubuntu 19.10 server running with OpenLiteSpeed web server.
No comments: