Lighttpd is a lightweight web server designed for high-performance environments. In this guide, we will walk through the steps to install Lighttpd with PHP and secure it using a free Let's Encrypt SSL certificate on Debian 11.
Step 1: Update Your System
Before starting the installation, ensure your system is up to date:
sudo apt update && sudo apt upgrade
Step 2: Install Lighttpd
Install the Lighttpd web server by running the following command:
sudo apt install lighttpd
Step 3: Install PHP and Required Extensions
Next, install PHP and necessary extensions for Lighttpd:
sudo apt install php php-cgi php-mysql
Step 4: Configure Lighttpd to Use PHP
To enable PHP processing in Lighttpd, you need to load the PHP CGI module. Run the following command:
sudo lighttpd-enable-mod fastcgi
sudo lighttpd-enable-mod fastcgi-php
After enabling the modules, restart Lighttpd to apply the changes:
sudo systemctl restart lighttpd
Step 5: Install Certbot for Let's Encrypt SSL
Certbot is a tool to obtain and manage Let's Encrypt SSL certificates. Install Certbot and the Lighttpd plugin:
sudo apt install certbot python3-certbot-lighttpd
Step 6: Obtain an SSL Certificate
Run the following command to obtain a free SSL certificate for your domain:
sudo certbot --lighttpd
Follow the prompts to enter your email address and agree to the terms of service. Certbot will automatically configure Lighttpd to use the new SSL certificate.
Step 7: Verify SSL Configuration
After obtaining the SSL certificate, verify that Lighttpd is serving your site over HTTPS. Open your web browser and navigate to:
https://your_domain
Step 8: Set Up Automatic Certificate Renewal
Let's Encrypt certificates are valid for 90 days, but Certbot can automatically renew them. To set up a cron job for automatic renewal, run:
echo "0 0 * * * root certbot renew --quiet" | sudo tee -a /etc/crontab
Conclusion
You have successfully installed Lighttpd with PHP and secured it with a free Let's Encrypt SSL certificate on Debian 11. Your web server is now ready to serve secure content.
If you're looking for a reliable VPS hosting solution for your Lighttpd server, consider using Windows VPS UK. With Windows VPS, you can enjoy high-performance hosting tailored to your web applications. Whether you need VPS UK Windows or Windows Virtual Private Servers, you’ll find a solution that meets your requirements.
For larger deployments or enterprise needs, explore Windows Virtual Dedicated Server Hosting or Virtual Private Server Hosting Windows. Whether you're located in the UK, Italy, or elsewhere, Windows VPS Italy and UK VPS Windows offer reliable hosting options. Visit Windows VPS Hosting UK to discover the best hosting solutions for your Lighttpd deployment.