OpenLiteSpeed is a lightweight and high-performance web server that is known for its speed and scalability. Paired with MariaDB, a popular open-source database system, it provides a powerful platform for hosting websites and applications. In this guide, we will walk you through the installation and configuration of OpenLiteSpeed on Ubuntu 18.04 LTS along with MariaDB. Whether you're using a Windows VPS UK or any other hosting provider, this setup will help you build a reliable and fast server environment.

Prerequisites

Before you begin, ensure you have the following:

Step 1: Update Your System

First, update your system to ensure all packages are up to date:

sudo apt update && sudo apt upgrade -y

Step 2: Install OpenLiteSpeed

OpenLiteSpeed is not available in the default Ubuntu repositories, so you need to add the official OpenLiteSpeed repository:

wget -O - https://repo.litespeed.sh | sudo bash

Now install OpenLiteSpeed with the following command:

sudo apt install openlitespeed -y

After installation, start the OpenLiteSpeed service and enable it to start on boot:

sudo systemctl start lsws
sudo systemctl enable lsws

Step 3: Install PHP for OpenLiteSpeed

To enable PHP on OpenLiteSpeed, install the necessary PHP packages. OpenLiteSpeed provides a simple way to install PHP:

sudo apt install lsphp74 lsphp74-mysql -y

Once installed, you can configure OpenLiteSpeed to use PHP by linking it to the installed PHP binary:

sudo ln -s /usr/local/lsws/lsphp74/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp

Step 4: Access OpenLiteSpeed Admin Panel

OpenLiteSpeed has a web-based admin interface. To access it, open your web browser and navigate to http://your-server-ip:7080.

The default login credentials are:

  • Username: admin
  • Password: 123456

For security reasons, change the default admin password using the following command:

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

Step 5: Install MariaDB

MariaDB is the database system that will store your website's data. Install MariaDB using the following command:

sudo apt install mariadb-server -y

Once installed, start and enable the MariaDB service:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 6: Secure MariaDB Installation

To enhance the security of your MariaDB installation, run the following security script:

sudo mysql_secure_installation

Follow the on-screen prompts to set a root password, remove anonymous users, disable remote root login, and remove the test database.

Step 7: Create a Database for Your Application

Log in to the MariaDB shell:

sudo mysql -u root -p

Create a new database and user for your application:

CREATE DATABASE myappdb;
CREATE USER 'myappuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON myappdb.* TO 'myappuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 8: Configure OpenLiteSpeed Virtual Hosts

To host your website or application, you need to configure a virtual host in OpenLiteSpeed. Go to the OpenLiteSpeed admin panel at http://your-server-ip:7080 and navigate to Virtual Hosts.

Create a new virtual host and configure it to point to the directory where your application will be hosted. You can also set the document root, PHP settings, and other configurations through this panel.

Step 9: Test Your Setup

Create a test PHP file to verify that OpenLiteSpeed is correctly configured to handle PHP. In your web root directory, create a file called info.php:

sudo nano /usr/local/lsws/DEFAULT/html/info.php

Add the following content to the file:

<?php phpinfo(); ?>

Save the file and navigate to http://your-server-ip/info.php in your browser. You should see the PHP info page, indicating that PHP is working correctly.

Conclusion

By following these steps, you have successfully installed and configured OpenLiteSpeed and MariaDB on Ubuntu 18.04 LTS. This setup provides a powerful and high-performance web server solution that can be used for hosting a variety of websites and applications. Whether you're using a Windows VPS UK, Windows VPS Italy, or another Windows Virtual Private Server Hosting solution, OpenLiteSpeed paired with MariaDB is an efficient and scalable choice for web hosting.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)