GICT knowledge base
How to Install OpenLiteSpeed on Ubuntu 24.04
Published
Setting up a web server can be tricky, but OpenLiteSpeed makes things easier than most alternatives. This guide covers everything you need to know about getting it running on Ubuntu 24.04.
OpenLiteSpeed has gained attention because it’s fast and doesn’t cost anything. Many hosting companies now use it instead of Apache because websites load quicker. The admin panel is also much easier to work with than editing config files manually.
What Makes OpenLiteSpeed Different
Most web servers require you to edit text files whenever you want to change settings. OpenLiteSpeed gives you a web interface instead. You can adjust almost everything through your browser, which saves time and reduces mistakes.
The performance is impressive, too. During testing, sites typically load 30-40% faster compared to Apache setups. It handles more visitors at once without slowing down your server.
Another advantage is the built-in caching system. WordPress sites especially benefit from this feature. Page load times drop significantly once you enable caching.
Security features come standard as well. Rate limiting prevents spam attacks, and DDoS protection helps during traffic spikes. These features usually cost extra with other web servers.
Getting Started
You’ll need a fresh Ubuntu 24.04 installation with root access. The server should have at least 2GB of RAM for decent performance. Less memory will work but expect slower response times.
Make sure you have a stable internet connection, too. The installation downloads several packages and can take 15-20 minutes on slower connections.
Updating the System
Start by getting your system current. This prevents compatibility issues later:
sudo apt update
sudo apt upgrade -y
This process updates all installed packages to their latest versions. Some updates require a reboot, so plan accordingly.
Adding the Repository
Ubuntu doesn’t include OpenLiteSpeed by default. You need to add their official repository first:
sudo apt install wget gnupg2 -y
Then, add the actual repository:
wget -O - https://repo.litespeed.sh | sudo bash
This downloads a script that configures everything automatically. The script is safe – it’s the official method recommended by the developers.
Installing OpenLiteSpeed
Now you can install the actual software:
sudo apt update
sudo apt install openlitespeed -y
The download is about 50MB and takes a few minutes, depending on your connection speed. Ubuntu handles all the dependencies automatically.
Starting the Service
OpenLiteSpeed doesn’t start by itself after installation. You need to start it manually:
sudo systemctl start lsws
Also, enable it to start automatically when the server boots:
sudo systemctl enable lshttpd.service
Check that everything is working:
sudo systemctl status lsws
You should see “active (running)” in the output. If not, something went wrong during installation.
Configuring the Firewall
Most Ubuntu servers have a firewall enabled. You need to open the right ports for web traffic:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 7080/tcp
Port 80 handles regular web traffic, 443 is for secure connections, 7080 is for the admin panel, and 8088 is used to verify the OpenLiteSpeed installation welcome page.
Creating Admin Access
You need login credentials to access the control panel:
sudo /usr/local/lsws/admin/misc/admpass.sh
This script asks for a username and password. Pick something secure since this gives full control over your web server.
Write down these credentials somewhere safe. You’ll need them every time you want to change server settings.
Accessing the Control Panel
Open your web browser and go to:
https://your-server-ip:7080
Replace your-server-ip with your actual server address. If you’re testing locally, use localhost instead.
Your browser will show a security warning about the SSL certificate. This happens because OpenLiteSpeed creates its own certificate during installation. Click through the warning – it’s safe in this case.
Log in with the credentials you just created. The interface should load without any problems.
Basic Setup
The control panel has several main sections. Start with these:
- Go to “Configuration” > “General” to set basic server information. Add your email address and server name here.
- The “Listeners” section controls which ports your server uses. The defaults work fine for most situations.
- “Virtual Hosts” is where you configure individual websites. You can create multiple sites on one server this way.
Take some time to explore the interface. Everything is organized logically, but there are many options available.
Testing Everything
To verify your installation worked correctly, visit:
http://your-server-ip:8088
You should see a welcome page with the OpenLiteSpeed logo. This confirms the web server is responding to requests properly.
Installing PHP
Most websites need PHP to function. Install the latest version:
sudo apt install lsphp82 lsphp82-mysql lsphp82-curl lsphp82-gd -y
This gives you PHP 8.2 with the most common extensions. You can add more extensions later if your applications need them.
Common Problems
Sometimes, the service won’t start after installation. Check the error logs:
sudo tail -f /usr/local/lsws/logs/error.log
Port conflicts cause issues, too. If you have Apache running, stop it first:
sudo systemctl stop apache2
sudo systemctl disable apache2
Memory problems show up as slow performance. Monitor your RAM usage and upgrade if necessary.
File permission errors can prevent websites from loading. Make sure your web files have the right ownership and permissions.
Security Setup
- Change the default admin port from 7080 to something else. This makes automated attacks less likely to succeed.
- Set up proper SSL certificates for production sites. Let’s Encrypt provides free certificates that work perfectly with OpenLiteSpeed.
- Configure rate limiting to prevent abuse. The admin panel has settings for this under the security section.
Regular updates are crucial for security. Check for OpenLiteSpeed updates monthly:
sudo apt update
sudo apt upgrade openlitespeed
Performance Tuning
- Enable caching for better performance. Go to the Virtual Host settings and turn on caching options.
- Adjust worker processes based on your server’s CPU cores. More cores can handle more worker processes.
- Set appropriate connection limits based on your expected traffic. Too high wastes memory, and too low causes slowdowns.
- Monitor your server stats through the admin panel. Watch for bottlenecks during peak traffic times.
Backup Strategy
Back up your configuration files regularly. They’re stored in:
/usr/local/lsws/conf/
Website files should be backed up, too. Most sites store files in:
/usr/local/lsws/Example/html/
Database backups are separate if you’re using MySQL or PostgreSQL. Set up automated database dumps.
Test your backup restoration process before you need it. Broken backups are worse than no backups.
Maintenance Tasks
Log files grow over time and can fill up your disk. Set up log rotation:
sudo nano /etc/logrotate.d/openlitespeed
Monitor disk space usage weekly. Web servers generate lots of logs and cache files.
Keep the underlying Ubuntu system updated, too:
sudo apt update && sudo apt upgrade -y
Check for security advisories related to OpenLiteSpeed and apply patches promptly.
Advanced Configuration
Once you’re comfortable with basic operations, explore advanced features like:
- Load balancing and clustering
- Using the powerful rewrite engine (start with simple redirects)
- Creating custom 404 and 500 error pages
- Geographic IP blocking to reduce unwanted traffic
Migration Considerations
- Moving from Apache to OpenLiteSpeed requires converting .htaccess files to OpenLiteSpeed format.
- Database migrations are usually straightforward since OpenLiteSpeed works with the same databases as Apache.
- Test everything thoroughly on a staging server before switching production traffic.
- Plan for downtime during the migration. DNS changes can take time to propagate.
Conclusion
OpenLiteSpeed offers excellent performance without the complexity of enterprise solutions. The web-based admin panel makes management straightforward compared to other web servers.
Regular maintenance keeps everything running smoothly. Update software, monitor performance, and maintain backups consistently.
The documentation is comprehensive once you get familiar with the terminology. Don’t hesitate to consult it when configuring advanced features.
Overall, OpenLiteSpeed provides a solid foundation for hosting websites of any size. The combination of speed, features, and ease of use makes it worth considering for your next web server deployment.
Related guides
How to Find Services That Need a Restart After Updates with needrestart
Find services using outdated libraries with needrestart on Ubuntu. Read restart reports, review automatic restart policy and plan maintenance safely.
UbuntuHow to Enable Brotli Compression in Nginx on Ubuntu 24.04
Enable Brotli in Ubuntu Nginx, preserve gzip fallback, verify response headers and avoid stale precompressed assets. Measure savings on your own files.
UbuntuHow to Prevent Overlapping Cron Jobs with flock
Prevent overlapping cron jobs with flock. Use a shared lock, understand skipped runs and verify that every entry point follows the locking policy.
UbuntuSecuring Ubuntu 24 SSH and other best practices
How to Lock Down Your Ubuntu 24 Server: A Beginner's Guide So, you just spun up a brand new Ubuntu 24 server. You may find a lot of SSH brute force logins failures.
