Setting Up Ubuntu Server with NGINX, Percona, and PHP 8.3-FPM

Introduction
If you're running a high-performance WordPress or WooCommerce site, an optimized Ubuntu + NGINX + Percona + PHP 8.3-FPM stack is essential. This guide will walk you through every step of setting up a powerful web server, ensuring optimal performance, security, and reliability.
✅ NGINX – A high-performance web server, faster than Apache.
✅ Percona Server for MySQL – Optimized for high-traffic databases.
✅ PHP 8.3-FPM – The latest PHP version with FastCGI Process Manager.
✅ ImageMagick – For high-quality image processing in WordPress.
1. Install Ubuntu Server and Update Packages
Ensure your Ubuntu system is up to date before installation.
sudo apt update && sudo apt upgrade -y
Install essential dependencies:
sudo apt install -y curl unzip software-properties-common
2. Install and Configure Percona Server for MySQL
A. Add the Percona Repository
wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb
sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb
sudo apt update
B. Install Percona Server
sudo apt install -y percona-server-server
C. Secure MySQL Installation
sudo mysql_secure_installation
✅ Set a strong root password.
✅ Disable remote root login (recommended).
✅ Remove anonymous users.
✅ Remove test databases.
D. Optimize Percona for WordPress & WooCommerce
Edit /etc/mysql/my.cnf and apply these performance optimizations:
[mysqld]
innodb_buffer_pool_size = 2G ; ideally you want this at least 8G or 16G or 75% ram
innodb_log_file_size = 512M
query_cache_type = 1
query_cache_size = 128M
slow_query_log = 1
slow_query_log_file = /var/log/mysql_slow.log
long_query_time = 2
Restart Percona:
sudo systemctl restart mysql
3. Install NGINX and Secure Configuration
A. Install NGINX
sudo apt install -y nginx
B. Configure NGINX for WordPress
Edit the NGINX site configuration file /etc/nginx/sites-available/wordpress:
server {
listen 80;
server_name yourdomain.com;
root /var/www/wordpress;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|eot|ttf|svg)$ {
expires max;
log_not_found off;
}
location ~* /uploads/.*\.php$ {
deny all;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* (xmlrpc\.php|wp-config\.php|wp-admin/install\.php) {
deny all;
}
}
Activate the configuration:
sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo systemctl restart nginx
4. Install PHP 8.3-FPM and Required Extensions
A. Add PHP 8.3 Repository
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
B. Install PHP 8.3 with FPM
sudo apt install -y php8.3-fpm php8.3-cli php8.3-mysql php8.3-curl php8.3-mbstring php8.3-xml php8.3-zip php8.3-gd php8.3-imagick
C. Configure PHP-FPM for WordPress
Edit /etc/php/8.3/fpm/php.ini and update these settings:
memory_limit = 512M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
cgi.fix_pathinfo = 0
Restart PHP-FPM:
sudo systemctl restart php8.3-fpm
5. Install ImageMagick for Image Processing
WordPress heavily relies on ImageMagick for image manipulation.
sudo apt install -y imagemagick php8.3-imagick
Restart services:
sudo systemctl restart nginx php8.3-fpm
6. Final Steps: Firewall & Testing
A. Open Required Ports
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
B. Verify Installation
Check services:
sudo systemctl status nginx mysql php8.3-fpm
Ensure your site loads at http://yourdomain.com.
Conclusion
✅ NGINX + Percona + PHP 8.3-FPM provides superior performance for WordPress & WooCommerce.
✅ Optimized configurations ensure fast page loads and efficient database queries.
✅ Using ImageMagick improves image processing speed.
🚀 Need expert help setting up a high-performance WordPress server? AKADATA provides professional hosting & optimization solutions!