This article explains how to install Drupal with Lighttpd support on Ubuntu 24.04.
Lighttpd is a lightweight web server designed for high-performance environments. It is particularly well-known for its efficient handling of many concurrent connections, making it an excellent choice for serving static content and dynamic applications with fast response times.
Drupal is an open-source CMS for building websites and online applications. Its scalability ranges from simple blogs to complex enterprise applications, ensuring it can meet your needs.
Integrating Drupal with Lighttpd on Ubuntu creates a robust and efficient web platform tailored to your needs, leveraging the strengths of both systems.
Install Lighttpd
Lighttpd packages are available in the default Ubuntu repositories and require no additional installations.
Run the command below to install Lighttpd.
sudo apt update
sudo apt install lighttpd
Once installed, the commands below can be used to start and enable the Lighttpd server services.
sudo systemctl start lighttpd
sudo systemctl enable lighttpd
Now that Lighttpd is installed, continue installing the database server below.
Install MariaDB
You will need a database server to run Drupal. A good open-source database is MariaDB.
Run the command below to install it.
sudo apt install mariadb-server
After installing the MariaDB database server, use the commands below to stop, start, and enable the MariaDB server to start when the server boots automatically.
sudo systemctl stop mariadb sudo systemctl start mariadb sudo systemctl enable mariadb
Run the following commands to validate and test if the MariaDB database server is installed successfully.
sudo mariadb
After executing the commands above, you will be logged into the MariaDB console, and a message similar to the one below will be displayed.
Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 32 Server version: 10.11.2-MariaDB-1 Ubuntu 23.04 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. MariaDB [(none)]>
The message tells you that the server is installed successfully.
Create a Drupal database
Upon successfully installing the MariaDB database server, create a blank database on the server specifically for the Drupal application.
As part of the setup, we will create a database named ‘drupaldb ‘and a corresponding user account called ‘drupaldbuser ‘.
Finally, we’ll grant the drupaldbuser full access to the drupaldb database.
All the database steps above can be done using the commands below:
But first, log on to the MariaDB database server:
sudo mariadb
Then run the commands below to complete the steps:
CREATE DATABASE drupaldb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER drupaldbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON drupaldb.* TO drupaldbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Ensure to replace ‘type_your_password_here‘ with your password.
Install PHP-FPM
The final component required to run Drupal is PHP-FPM. As a PHP application, Drupal supports the latest versions of PHP.
Run the commands below to install PHP-FPM.
sudo apt install php-fpm php-intl php-mysql php-curl php-cli php-zip php-xml php-gd php-common php-mbstring php-xmlrpc php-json php-sqlite3 php-soap php-zip
Additional help on installing PHP
How to install PHP on Ubuntu Linux
After installing PHP-FPM, run the command below to enable PHP support for Lighttpd.
sudo lighty-enable-mod fastcgi fastcgi-php-fpm
sudo systemctl restart php8.3-fpm
Next, open the Lighttpd PHP configuration file [/etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
] and edit the PHP block to turn it on.
sudo nano /etc/lighttpd/conf-available/15-fastcgi-php-fpm.conf
Change the highlighted block to turn on PHP support and specify the PHP version [8.3] to use.
## Use PHP-FPM service for PHP via FastCGI
fastcgi.server += ( ".php" =>
((
"socket" => "/run/php/php8.3-fpm.sock",
"broken-scriptfilename" => "enable"
))
)
Restart Lighttpd.
sudo systemctl restart lighttpd
Set up Drupal vhost
You are now ready to set up your Drupal virtual host file.
Run the command below to create a virtual host directory and put the Drupal vhost file [drupal.conf] in it.
sudo mkdir /etc/lighttpd/vhosts.d
sudo nano /etc/lighttpd/vhosts.d/drupal.conf
Copy and paste the block below into the file. Update the domain name to match yours.
$HTTP["host"] =~ "(^|.)drupal.example.com$" {
server.document-root = "/var/www/drupal"
server.errorlog = "/var/log/lighttpd/drupal.local-error.log"
accesslog.filename = "/var/log/lighttpd/drupal.local-access.log"
}
Save and exit the file.
Next, open the main Lighttpd configuration file.
sudo nano /etc/lighttpd/lighttpd.conf
Then, add the line below into the file to include all virtual hosts in the vhost directory.
#Include the vhosts directory
include "/etc/lighttpd/vhosts.d/*.conf"
Save and exit the file.
Restart Lighttpd.
sudo systemctl restart lighttpd
Download Drupal
Let’s begin downloading and configuring the Drupal files on Ubuntu Linux.
First, navigate to the /tmp/ directory and download Drupal files. After unzipping the file, move the content into the Drupal folder in the Nginx root directory.
The final step is to change the permissions. This will allow the Lighttpd web server to safely interact with the files, ensuring a secure environment for your Drupal installation.
sudo mkdir -p /var/www/drupal
cd /tmp/
wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
tar -xvf drupal.tar.gz
sudo mv drupal-*/* /var/www/drupal
sudo chown -R www-data:www-data /var/www/drupal/
After that, open your web browser and browse to the domain name configured above to begin setting up Drupal.
http://drupal.example.com
A new Drupal installation wizard will appear. Choose the site’s language and continue.

Next, select the installation profile.

Next, confirm all requirements are met and continue.
Then, type in the database name, username, and password created above.

Finally, set up your site name and create an admin account to log in.

Your new Drupal site should be created and ready to use.

Set up HTTPS
If you want to use HTTPS for your Drupal site, you can do that using the steps below.
First, go and obtain an SSL certificate for your server. If you don’t already have one, use the post below to learn how to get a Let’s Encrypt SSL certificate.
Generate a free Let’s Encrypt SSL certificate
After obtaining your certificate, open the Drupal virtual host file to edit it.
sudo nano /etc/lighttpd/vhosts.d/drupal.conf
Then, add the highlighted portion to the file.
$HTTP["scheme"] == "http" {
$HTTP["host"] == "drupal.example.com" {
url.redirect = ("/.*" => "https://drupal.example.com$0")
}
}
$SERVER["socket"] == ":443" {
ssl.engine = "enable"
ssl.pemfile = "/etc/letsencrypt/live/srv1.example.com/fullchain.pem"
ssl.privkey = "/etc/letsencrypt/live/srv1.example.com/privkey.pem"
server.name = "drupal.example.com"
server.document-root = "/var/www/drupal"
server.errorlog = "/var/log/lighttpd/drupal.local-error.log"
accesslog.filename = "/var/log/lighttpd/drupal.local-access.log"
}
Finally, enable the SSL module and restart Lighttpd.
sudo lighty-enable mod ssl
sudo systemctl restart lighttpd
That should do it!
Conclusion:
By following the steps outlined in this guide, you have successfully installed Drupal with Lighttpd on your Ubuntu 24.04 server. Here are the key takeaways:
- Lighttpd Installation: You installed Lighttpd, a high-performance web server, to handle your web traffic efficiently.
- MariaDB Setup: You configured MariaDB as your database server, creating a dedicated database and user for Drupal.
- PHP-FPM Configuration: You installed and configured PHP-FPM to enable PHP processing, which is essential for running the Drupal application.
- Drupal Setup: You downloaded and properly configured Drupal, ensuring the necessary permissions for web server access.
- HTTPS Security: You enhanced your site’s security by setting up HTTPS, protecting data transmitted between the server and users.
With these steps completed, your Drupal site is ready for use, delivering performance and security to enhance user experience.
Leave a Reply