Install WordPress with Lighttpd on Ubuntu 24.04
WordPress with Lighttpd on Ubuntu 24.04 creates a fast and efficient web server.
Lighttpd is a web server known for being lightweight and using very little computer memory. WordPress is a popular tool used to build websites, powering over 40% of all sites online.
This combination works well if you want a lean and speedy web hosting setup. It uses fewer resources than some other popular web servers like Apache.
Install Lighttpd using `sudo apt install lighttpd`, then install MariaDB with `sudo apt install mariadb-server`. Create a WordPress database and user within MariaDB. Finally, install PHP-FPM with `sudo apt install php-fpm` and configure Lighttpd to use it.
Install Lighttpd
To install Lighttpd on Ubuntu 24.04, you can use a simple command because the necessary packages are already in Ubuntu’s software lists. This command installs the Lighttpd web server, getting your system ready to host websites.
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 to install a database server below.
Install MariaDB
Setting up MariaDB on Ubuntu 24.04 is straightforward, making it a great database choice for your WordPress site. You can install the MariaDB server using a single command directly from Ubuntu’s software lists, which provides the essential database system.
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 WordPress database
Once MariaDB is set up, you need to create a dedicated database and user for your WordPress site. This guide shows you how to create a database named ‘wordpressdb’ and a user called ‘wordpressdbuser’ with the correct permissions for your WordPress installation.
As part of the setup, we will create a database named ‘wordpressdb ‘and a corresponding user account called ‘wordpressdbuser ‘.
Granting `wordpressdbuser` full access to the `wordpressdb` database ensures that your WordPress installation can create, read, update, and delete necessary data for your website to function correctly. This step is vital for the successful setup of your WordPress site on Ubuntu 24.04 with Lighttpd.
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 wordpressdb CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER wordpressdbuser@localhost IDENTIFIED BY 'type_your_password_here';
GRANT ALL ON wordpressdb.* TO wordpressdbuser@localhost WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit
Install PHP-FPM
PHP-FPM is crucial for WordPress as it processes your site’s PHP code, especially with newer versions. Installing PHP-FPM and the common PHP extensions WordPress needs is done with a single command, preparing your server to run your website smoothly.
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 WordPress vhost
Setting up a virtual host for WordPress on Lighttpd involves creating a specific directory and a configuration file. This file, named [wordpress.conf], tells Lighttpd how to display your WordPress site, making sure it’s accessible correctly.
Run the command below to create a virtual host directory and put the WordPress vhost file [wordpress.conf] in it.
sudo mkdir /etc/lighttpd/vhosts.d
sudo nano /etc/lighttpd/vhosts.d/wordpress.conf
Copy and paste the block below into the file. Update the domain name to match yours.
$HTTP["host"] =~ "(^|.)wordpress.example.com$" {
server.document-root = "/var/www/wordpress"
server.errorlog = "/var/log/lighttpd/wordpress.local-error.log"
accesslog.filename = "/var/log/lighttpd/wordpress.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 WordPress
Downloading the latest WordPress files onto your Ubuntu 24.04 server is the next step in setting up your site. You will download the files to a temporary location, move them to the correct web folder, and ensure the server has the necessary permissions to run WordPress.
The final step is to change the permissions. This will allow the Nginx web server to safely interact with the files, ensuring a secure environment for your WordPress installation.
cd /tmp/
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
sudo mv wordpress /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress/
After that, open your web browser and browse to the domain name configured above to begin setting up WordPress.
http://wordpress.example.com
A WordPress installation wizard page should appear. Select the installation language and continue to the next page.

Next, click the Let’s go button to begin the installation process.

Type the database name, account name, and password on the next screen. Then, click Submit.

Next, click the “Run the installation” button to install WordPress files.

Next, type in the site title, admin account, email address, and password. Then, click “Install WordPress.”

Your WordPress site should be set up and ready to use.

Set up HTTPS
Securing your WordPress site with HTTPS is vital and requires an SSL certificate. If you don’t have one, you can get a free one from Let’s Encrypt, and the first step is installing this certificate on your server to protect your site and user data.
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 WordPress virtual host file to edit it.
sudo nano /etc/lighttpd/vhosts.d/wordpress.conf
Then, add the highlighted portion to the file.
$HTTP["scheme"] == "http" {
$HTTP["host"] == "wordpress.example.com" {
url.redirect = ("/.*" => "https://wordpress.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 = "wordpress.example.com"
server.document-root = "/var/www/wordpress"
server.errorlog = "/var/log/lighttpd/wordpress.local-error.log"
accesslog.filename = "/var/log/lighttpd/wordpress.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:
In summary, installing WordPress with Lighttpd on Ubuntu 24.04 is a straightforward process that combines the efficiency of a lightweight web server with the flexibility of a robust CMS. Here are the key takeaways:
- Efficiency: Lighttpd handles concurrent connections effectively, making it suitable for high-performance websites.
- Database Setup: MariaDB is a reliable database solution for managing WordPress data.
- Flexible Configuration: Easy configuration of PHP with PHP-FPM allows for optimal performance of WordPress applications.
- Virtual Hosting: Setting up virtual hosts in Lighttpd facilitates managing multiple sites on a single server.
- User-Friendly Installation: The WordPress installation wizard simplifies the setup process for users, guiding them through necessary configurations.
- Customization: WordPress offers extensive themes and plugins for customization, catering to various website needs.
Following the above steps ensures a successful WordPress installation that leverages the strengths of both Lighttpd and Ubuntu. Enjoy building your new website.
Does WordPress work on Ubuntu?
WordPress serves as a CMS tool for website building. No payment is needed since it's open source software. Themes and plugins help customize the site without deep coding knowledge. Running WordPress on Ubuntu 24.04 works well because stability is good in this version.
What is lighttpd in Linux?
Lighttpd, often referred to as Lighty, is an open-source, high-performance web server that has a small memory footprint. Like NGINX, Lighttpd was originally developed to solve the c10k problem — to efficiently process 10,000 concurrent connections on one server.
WordPress Lighttpd Ubuntu is a setup that combines the WordPress content management system with the Lighttpd web server on an Ubuntu 24.04 operating system. This combination creates a fast and resource-efficient website hosting environment, ideal for users who want a lean and speedy server, especially when compared to heavier options like Apache.
- Open your terminal and update your package list with
sudo apt update. - Install the Lighttpd web server by running
sudo apt install lighttpd. - Start the Lighttpd service with
sudo systemctl start lighttpd. - Make sure Lighttpd starts automatically on boot using
sudo systemctl enable lighttpd. - Install the MariaDB database server with
sudo apt install mariadb-server. - Start and enable the MariaDB service using
sudo systemctl start mariadbandsudo systemctl enable mariadb. - Log into MariaDB to create your WordPress database and user.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!