OpenLiteSpeed is a powerful and open-source web server that offers high performance, stability, and easy configuration. In this guide, we'll walk through the process of installing and configuring OpenLiteSpeed with MariaDB and PHP on Ubuntu 20.04. Whether you're using a Windows VPS UK or another VPS solution, this setup will ensure your web server is optimized for performance.

Prerequisites

Before getting started, make sure you have the following:

Step 1: Update Your System

Start by updating your system’s package list to ensure all software is up to date. Run the following commands:

sudo apt update && sudo apt upgrade

Step 2: Install OpenLiteSpeed

OpenLiteSpeed is available from the official LiteSpeed repository. To install it, first add the repository to your system:

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

Next, install OpenLiteSpeed with the following command:

sudo apt install openlitespeed

After installation, start and enable the OpenLiteSpeed service:

sudo systemctl start lsws
sudo systemctl enable lsws

Step 3: Install PHP for OpenLiteSpeed

OpenLiteSpeed works with multiple versions of PHP. You can install PHP 7.4 (or another version if preferred) with the following command:

sudo apt install lsphp74 lsphp74-mysql lsphp74-curl lsphp74-json lsphp74-xml

Once installed, configure OpenLiteSpeed to use the installed PHP version. Navigate to the OpenLiteSpeed admin panel at http://your-server-ip:7080 and log in with the default credentials:

  • Username: admin
  • Password: 123456

Change the default password and configure the server to use PHP 7.4 by navigating to Server Configuration > External App and adding the new PHP version path: /usr/local/lsws/lsphp74/bin/lsphp.

Step 4: Install and Configure MariaDB

MariaDB is a popular open-source database server. To install it, run the following command:

sudo apt install mariadb-server

Once installed, secure the MariaDB installation:

sudo mysql_secure_installation

Follow the prompts to set up a root password and remove insecure defaults. Next, create a new database and user for your web applications:

sudo mysql -u root -p
CREATE DATABASE mydatabase;
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';
GRANT ALL PRIVILEGES ON mydatabase.* TO 'myuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Configure OpenLiteSpeed to Serve PHP Pages

To test if OpenLiteSpeed is properly serving PHP pages, create a simple PHP file in the OpenLiteSpeed web root:

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

Add the following PHP code:

<?php
phpinfo();
?>

Save the file and then visit http://your-server-ip/info.php in your browser. You should see the PHP information page, confirming that PHP is working correctly on your server.

Step 6: Secure Your OpenLiteSpeed Server

It's important to secure your server by enabling SSL with Let's Encrypt. Install the Certbot tool for Let's Encrypt SSL certificates:

sudo apt install certbot

Then, generate an SSL certificate for your domain:

sudo certbot certonly --standalone -d your-domain.com

After obtaining the certificate, configure OpenLiteSpeed to use it by navigating to the admin panel and setting up SSL under Listeners. This will ensure that your server is secure, whether it's hosted on a Windows VPS Italy or another VPS Windows Servers solution.

Conclusion

By following these steps, you have successfully installed and configured OpenLiteSpeed along with MariaDB and PHP on Ubuntu 20.04. This setup provides a high-performance environment for your web applications, whether you're using a Windows VPS UK or another VPS hosting solution. OpenLiteSpeed's ease of use and performance make it a great choice for modern web hosting.

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