Setting up WordPress on an Ubuntu 24.04 server using NGINX as the web server can significantly improve your website’s performance and scalability. This guide will walk you through the entire process, from preparing your server to installing WordPress and configuring NGINX.
Prerequisites
Before starting, ensure you have the following:
- An Ubuntu 24.04 server with a non-root user with sudo privileges.
- A domain name pointed to your server’s IP address.
- Basic knowledge of the Linux command line.
Commands
sudo apt install nginx
systemctl status nginx.service
sudo apt install mysql-server
sudo mysql -u root
CREATE DATABASE wordpress_db;
CREATE USER 'zack'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'sam'@'localhost';
FLUSH PRIVILEGES;
EXIT;
sudo apt install -y php8.1 php8.1-cli php8.1-fpm php8.1-mysql
wget https://wordpress.org/latest.zip
sudo unzip latest.zip
sudo mv wordpress/* /var/www/html/
sudo chown -R www-data:www-data /var/www/html/*
cd /var/www/html/
sudo rm index.html index.nginx-debian.html
sudo mv wp-config-sample.php wp-config.php sudo nano wp-config.php
sudo nano wp-config.php
====================================================================================
server { listen 80; server_name your_domain.com www.your_domain.com; root /var/www/html/; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; } location ~ /\.ht { deny all; } } ===================================================================================
sudo rm /etc/nginx/sites-enabled/default
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
sudo systemctl reload nginx.service Video: How to install and Configure WordPress in Ubuntu 24.04