Atlantic.Net Blog

How to Install WordPress with Lighttpd Web Server on Ubuntu 20.04

Hitesh Jethva
by Atlantic.Net (272 posts) under Dedicated Server Hosting, Tutorials
0 Comments

Lighttpd is a free, open-source, and lightweight web server known for its fast speed. It is simple and easy to install and it provides a web-based interface to control and manage the application.

WordPress is a free and open-source content management system that allows you to create a blog and website from a web-based interface. Installing WordPress with Lighttpd will increase the speed and performance of your website.

In this post, we will show you how to install WordPress with a Lighttpd web server on Ubuntu 20.04.

Prerequisites

  • A fresh Ubuntu 20.04 server on the Atlantic.Net Cloud Platform
  • A root password configured on your server

Step 1 – Create Atlantic.Net Cloud Server

First, log in to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system with at least 2GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged in to your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

apt-get update -y

Step 2 – Install Lighttpd, MariaDB, and PHP

First, install the Lighttpd, MariaDB, PHP, and other PHP extensions using the following command:

apt-get install mysql-server lighttpd php php-fpm php-mysql php-cli php-curl php-xml php-json php-zip php-mbstring php-gd php-intl php-cgi -y

The above command will also install the Apache package to your server, so you will need to remove it and stop the Apache service.

apt-get remove apache2 -y
systemctl stop apache2

Next, start the Lighttpd service and enable it to start at system reboot:

systemctl start lighttpd
systemctl enable lighttpd

Step 3 – Configure PHP-FPM to Work with Lighttpd

Next, you will need to configure PHP-FPM to work with Lighttpd. To do so, edit the www.conf file:

nano /etc/php/7.4/fpm/pool.d/www.conf

Find the following line:

listen = /run/php/php7.4-fpm.sock

And, replace it with the following line:

listen = 127.0.0.1:9000

Save and close the file, then edit the 15-fastcgi-php.conf file:

nano /etc/lighttpd/conf-available/15-fastcgi-php.conf

Find the following lines:

"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",

And, replaced them with the following lines:

"host" => "127.0.0.1",
"port" => "9000",

Save and close the file, then enable the required modules with the following command:

lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php

Next, restart the Lighttpd and PHP-FPM service to apply the changes:

systemctl restart lighttpd
systemctl restart php7.4-fpm

Step 4 – Create a Database for WordPress

Next, log in to the MariaDB with the following command:

mysql

Once you are log in, create a database and user with the following command:

CREATE DATABASE wpdb;
GRANT ALL PRIVILEGES on wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'password';

Next, flush the privileges and exit from the MariaDB:

FLUSH PRIVILEGES;
EXIT;

Step 5 – Install WordPress

Next, change the directory to the Lighttpd web root directory and download the latest version of WordPress using the following command:

cd /var/www/html
wget https://wordpress.org/latest.tar.gz

Once the download is completed, extract the downloaded file with the following command:

tar -xvzf latest.tar.gz

Next, change the directory to WordPress and rename the sample configuration file:

cd wordpress
mv wp-config-sample.php wp-config.php

Next, edit the configuration file and define your database settings:

nano wp-config.php

Change the following lines:

/** The name of the database for WordPress */
define( 'DB_NAME', 'wpdb' );

/** MySQL database username */
define( 'DB_USER', 'wpuser' );

/** MySQL database password */
define( 'DB_PASSWORD', 'password' );

/** MySQL hostname */
define( 'DB_HOST', 'localhost' );

/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

Save and close the file, then set proper permissions and ownership with the following command:

chown -R www-data:www-data /var/www/html/wordpress
chmod -R 755 /var/www/html/wordpress

Step 6 – Configure Lighttpd for WordPress

First, create a directory to store the virtual host configuration file:

mkdir -p /etc/lighttpd/vhosts.d/

Next, edit the Lighttpd configuration file:

nano /etc/lighttpd/lighttpd.conf

Add mod_rewrite in the following block:

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
        "mod_rewrite",
)

And define the path of your virtual host configuration directory:

include_shell "cat /etc/lighttpd/vhosts.d/*.conf"

Save and close the file. Then, create a new virtual host configuration file for WordPress:

nano /etc/lighttpd/vhosts.d/wordpress.conf

Add the following lines:

$HTTP["host"] =~ "(^|.)wordpress.example.com$" {
server.document-root = "/var/www/html/wordpress"
server.errorlog = "/var/log/lighttpd/wordpress-error.log"

}

Save and close the file, then restart the Lighttpd service to apply the changes:

systemctl restart lighttpd

Step 7 – Access WordPress Dashboard

Now, open your web browser and access the WordPress installation wizard using the URL http://wordpress.example.com. You should see the following page:
WordPress Welcome Page
Select your language and click on the Continue button. You should see the following page:
WordPress Site Information Page
Provide your site information and click on the Start the installation button. Once the installation is completed, you should see the following screen:
WordPress Installation Finished Page
Click on the Login button. You should see the WordPress login page;
WordPress Login Page
Provide your admin username and password and click on the Login button. You should see the WordPress admin dashboard on the following screen:
WordPress Dashboard Page

Conclusion

Congratulations! You have successfully installed WordPress with Lighttpd on Ubuntu 20.04. You can now create a high-performance website or blog from the WordPress dashboard on your dedicated server from Atlantic.Net.

Get A Free To Use Cloud VPS

Free Tier Includes:
G3.2GB Cloud VPS Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


Looking for a Hosting Solution?

We Provide Cloud, Dedicated, & Colocation.

  • Seven Global Data Center Locations.
  • Flexible Private, Public, & Hybrid Hosting.
  • 24x7x365 Security, Support, & Monitoring.
Contact Us Now! Med Tech Award FTC
SOC Audit HIPAA Audit HITECH Audit

Recent Posts

Get started with 12 months of free cloud VPS hosting

Free Tier includes:
G3.2GB Cloud VPS Server Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year


New York, NY

100 Delawanna Ave, Suite 1

Clifton, NJ 07014

United States

San Francisco, CA

2820 Northwestern Pkwy,

Santa Clara, CA 95051

United States

Dallas, TX

2323 Bryan Street,

Dallas, Texas 75201

United States

Ashburn, VA

1807 Michael Faraday Ct,

Reston, VA 20190

United States

Orlando, FL

440 W Kennedy Blvd, Suite 3

Orlando, FL 32810

United States

Toronto, Canada

20 Pullman Ct, Scarborough,

Ontario M1X 1E4

Canada

London, UK

14 Liverpool Road, Slough,

Berkshire SL1 4QZ

United Kingdom

Resources