Complete step-by-step guide to installing a production-ready LEMP stack with PHP 8.3 and secure MariaDB
By following this guide, you will have a fully functioning LEMP stack (Linux, Nginx, MariaDB, PHP 8.3) configured for production performance on an Ubuntu 24.04 server. You will be able to serve high-speed dynamic web applications with automated process management and database support.
Spin up an Ubuntu 24.04 instance with instant activation to test this tutorial:
Deploy IndSoft VPSAn Ubuntu 24.04 server with at least 1 GB RAM, non-root user with sudo privileges, and a registered domain name pointing to your server's IP address. Recommended platform: IndSoft Standard VPS (2 vCPU, 2GB RAM).
Start by synchronizing your system's package indices and installing the latest stable Nginx web server.
sudo apt update && sudo apt upgrade -y
sudo apt install nginx -yEnsure the Uncomplicated Firewall (UFW) permits incoming HTTP (port 80) and HTTPS (port 443) traffic.
sudo ufw allow 'Nginx Full'
sudo ufw statusInstall the MariaDB relational database management system and execute the security script.
sudo apt install mariadb-server -y
sudo mysql_secure_installationInstall PHP 8.3 along with the PHP-FPM FastCGI process manager and MySQL driver modules.
sudo apt install php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-zip -yCreate a server block configuration under /etc/nginx/sites-available/example.com to process .php files via unix socket.
sudo nano /etc/nginx/sites-available/example.com
# Add server block with:
# location ~ \.php$ {
# include snippets/fastcgi-php.conf;
# fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
# }
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginxRun this quick verification check to confirm your installation is responding properly:
curl -I http://localhostQuick resolutions for frequent setup pitfalls and configuration issues.
sudo systemctl status php8.3-fpm. Ensure /var/run/php/php8.3-fpm.sock exists.
sudo mariadb directly without a password parameter.
sudo ufw status verbose and ensure 'Nginx Full' is permitted on active interfaces.