
OpenLiteSpeed is a free, open-source, and lightweight webserver developed by LiteSpeed Technologies. It's known for its high performance and low resource consumption, making it a popular choice for hosting web applications. OpenLiteSpeed is compatible with Apache configurations, supports multiple programming languages, and includes built-in security features and caching mechanisms.
This article explains how to install OpenLiteSpeed webserver on Rocky Linux 9 and create virtual hosts using the web administration console to deliver web applications.
Before you begin:
app.example.com.The OpenLiteSpeed webserver package is not available in the default repositories on Rocky Linux 9. Follow the steps below to download the latest OpenLiteSpeed repository setup script to install the webserver using the DNF package manager.
Download the latest OpenLiteSpeed repository script.
Install OpenLiteSpeed.
View the installed OpenLiteSpeed version on your server.
Output:
Run the OpenLiteSpeed administrator password script to set up a new administrative user and password.
Enter your desired username and password when prompted similar to the output below.
Disable the default firewalld firewall to temporarily enable Let's Encrypt validations and configure the webserver.
Access your server IP address using a web browser such as Chrome on port 8088 to verify that the default OpenLiteSpeed virtual host web application displays.
OpenLiteSpeed uses the lsws system service to manage the webserver processes using systemd. Follow the steps below to enable the OpenLiteSpeed service to start at boot time and manage the webserver processes.
Enable the OpenLiteSpeed service to automatically start at boot time.
Start the OpenLiteSpeed service.
View the OpenLiteSpeed service status and verify that it's active.
Output:
Based on the above active (running) message in the output, the OpenLiteSpeed service is active and running on your server.
OpenLiteSpeed virtual hosts allow you to host multiple domains or subdomains to securely deliver web applications on your server. Follow the steps below to create a new OpenLiteSpeed virtual host for your domain app.example.com that serves an HTML web application and outputs the message Greetings from Vultr when accessed.
Access the OpenLiteSpeed web administration console using your server IP on the default port 7080 in a new web browser window.
Enter the administrative user and password you set earlier to access the WebAdmin console.
Click Virtual Hosts on the main navigation menu.
Click Add in the top right corner within the Virtual Host List section.
Enter the following virtual host details in the respective fields.
app.example.com$SERVER_ROOT/conf/vhosts/$VH_NAME/$SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.confYesYesYesClick Save to save the new virtual host configuration. Then, when prompted to resolve errors, find and click CLICK TO CREATE to create a new configuration file and web root directory.
Click Save to apply the new virtual host configuration on your server.
Verify that the new virtual host is available in your Virtual Host List section. Then, click View within the actions section to modify the virtual host configuration.
Click Edit within the General tab to modify the virtual host configuration.
Enter the following values in the respective fields to enable on your virtual host. Replace app.example.com with your actual domain.
$SERVER_ROOT/conf/vhosts/$VH_NAME/app.example.comYES
Click Save to apply the new virtual host configuration changes.
Click Edit within the Index Files section to set up your virtual host index information.
Enter the following values in the respective fields to set up the default virtual host web application file.
Noindex.htmlNoClick Save to apply the new index page changes.
Navigate to the Log tab.
Click Edit within the Virtual Host Log section to modify the virtual host log information.
Enter the following details in the respective fields to set up logging.
Yes$SERVER_ROOT/conf/vhosts/$VH_NAME/error.logERROR10M7YesClick Save to apply the log changes.
Navigate to Listeners on the main navigation menu.
Click Edit in the Actions section next to the Default listener to modify the default webserver configuration.
Click Edit within the Address Settings section to modify the default address and information.
Change the default listening Port value from 8088 to the HTTP port 80.
Click Save to apply the new listening address information.
Find the Virtual Host Mappings section, and click the Edit icon next to the Example virtual host to modify the default domain.
Enter the following values in the respective fields. Replace app.example.com with your actual domain.
Click Save to apply the new default virtual host domain.
Find LSWS PID in the top right corner of the console and click Graceful Restart to restart the OpenLiteSpeed webserver.
Click GO when prompted to restart the LiteSpeed service and apply your configuration changes.
Access your server SSH session.
Create a new index.html web application file in your virtual host's web root directory.
Add the following contents to the file.
Save and close the file.
The above HTML application file displays a Greetings from Vultr message when accessed in a web browser.
Create a new error log file for your virtual host.
Grant the OpenLiteSpeed user full privileges to the virtual host web root directory.
Change the virtual host web root directory permissions to 755 to grant the OpenLiteSpeed user read, write and execute privileges.
Access your domain in a new web browser window and verify that your HTML web application displays the message Greetings from Vultr.
The OpenLiteSpeed webserver delivers all web applications using the default HTTP port 80 as defined in your listener configurations. Follow the steps below to generate new Let's Encrypt SSL certificates to secure the OpenLiteSpeed webserver with HTTPS traffic.
Install the Certbot Let's Encrypt client tool on your server.
Generate a new Let's Encrypt SSL certificate for your domain using the virtual host's web root directory. Replace app.example.com with your actual domain and admin@example.com with your email address.
Output:
Based on the above SSL certificate output, your new SSL certificate is available with the /etc/letsencrypt/live/app.example.com/fullchain.pem path and the private key /etc/letsencrypt/live/app.example.com/privkey.pem. You can use the paths to integrate your SSL certificate with virtual hosts in the OpenLiteSpeed WebAdmin console.
Access your OpenLiteSpeed web administration console.
Navigate to Listeners on the main navigation menu.
Click Add within the Listener List section to set up a new listener.
Click Edit within the Address Settings section to set up a new address and port to listen for incoming connections.
Enter the following values in the respective fields to set up a new HTTPS connections listener.
HTTPSANY IPv4443YesClick Save to apply the new HTTPS configuration.
Find the Virtual Host Mappings section and click Add to map the listener with your default virtual host domain.
Enter the following values in the respective files to enable HTTPS on your main virtual host domain.
app.example.comapp.example.comClick Save to apply your new domain mapping changes.
Navigate to the SSL tab.
Edit the SSL Private Key & Certificate section to define your SSL certificate information.
Enter your Let's Encrypt SSL private key path /etc/letsencrypt/app.example.com/privkey.pem in the Private Key File field.
Enter your Let's Encrypt SSL certificate path /etc/letsencrypt/app.example.com/fullchain.pem in the Certificate File field.
Navigate to Virtual Hosts on the main navigation menu to modify your existing virtual host information.
Edit your app.example.com virtual host.
Click Rewrite within the virtual host configuration page to set up new rewrite rules.
Edit the Rewrite Control section and set Enable Rewrite to Yes. Then, click Save to apply the rewrite changes.
Find the Rewrite Rules section and click Edit to set up new rules.
Add the following configurations within the Rewrite Rules field. Then, click Save to apply the new rules.
Click Graceful Restart in the top right corner of the console to restart the OpenLiteSpeed webserver and apply your configuration changes.
Access your domain in a new web browser window using HTTPS and verify that your connection is encrypted with a valid SSL certificate.
FirewallD is available and active on Vultr Rocky Linux 9 servers by default. It blocks all unpermitted network connections and requests on the server. Follow the steps below to set up new firewall rules to allow access to the OpenLiteSpeed web administration console, HTTP, and HTTPS connections on your server.
Start the firewalld service again.
Allow the OpenLiteSpeed port 7080, HTTP port 80, and HTTPS port 443 through the firewall.
Reload the firewalld configuration to apply the new firewall rules.
View all allowed ports in the firewall table and verify that your permitted ports are available.
Output.
You have installed the OpenLiteSpeed webserver on Rocky Linux 9 and created a new virtual host to deliver web applications on your server using the web administration console. OpenLiteSpeed supports multiple virtual hosts and domains you can configure on your server to enable secure encrypted connections using valid SSL certificates. For more information, visit the OpenLiteSpeed documentation.
0 Comments
Be the first to comment and share your perspective with the community.