Skip to main content

Installing WordPress on Ubuntu 24.04 with LEMP Stack

A step-by-step guide to installing and configuring WordPress on Ubuntu 24.04 servers using the LEMP stack including Nginx, MySQL, and PHP.

AI-written
Inewgen
10 Sep 2026Source: Dev.to2 min read (0 views)
Share
Installing WordPress on Ubuntu 24.04 with LEMP Stack

Stock photo for illustration only, not from the actual event

Font size
  • Install WordPress on an Ubuntu 24.04 server using the LEMP stack
  • Configure the Nginx web server and manage the UFW firewall
  • Set up the MySQL database server and create a dedicated WordPress user
  • Install PHP and essential extensions required for dynamic web hosting

WordPress is a free, open-source content management system built with PHP and backed by MySQL or MariaDB, powering over 22% of the top one million websites. This guide walks through installing and configuring WordPress on an Ubuntu 24.04 server running the LEMP stack, which includes Linux, Nginx, MySQL, and PHP, delivering a robust environment for your dynamic websites.

Before you begin, ensure you have access to an Ubuntu 24.04 instance as a non-root sudo user, along with a configured domain A record pointing to your server IP if using a custom domain. The installation process starts by deploying the Nginx web server:

  • Install Nginx package: sudo apt install nginx -y
  • Start the Nginx service: sudo systemctl start nginx
  • Enable Nginx to start automatically on boot: sudo systemctl enable nginx
  • Verify the service status: sudo systemctl status nginx
linux server terminal code screen

Stock photo for illustration only, not from the actual event

Deploying WordPress on Ubuntu 24.04 with a LEMP stack provides a highly reliable and performant web architecture. Properly securing your firewall rules and database credentials forms a critical foundation for running a secure production website capable of handling dynamic traffic loads efficiently.

Never miss the latest news?

Subscribe to get news summaries by email - not often enough to be annoying.

โฆษณา

The next phase involves configuring the UFW firewall to allow HTTP and HTTPS traffic using the Nginx Full profile, reloading the firewall rules to apply changes. Following firewall configuration, you install the MySQL database server package and run the built-in security script to harden your database setup.

You then proceed to create a dedicated MySQL database named wordpressdb and a new user wordpressdbuser with a strong password, granting full privileges on the database and flushing privileges before verifying the database and user creation via the MySQL shell.

The final step requires installing PHP and all required extensions to process dynamic content and communicate with the MySQL database. Using apt, you install packages such as php-fpm, php-mysqli, and php-xml, and verify the installed PHP version to complete the setup.

Source: Dev.to

Comments

Leave a Comment
0/2000

Found something wrong in this article? Report an issue with this article