This guide installs the Nginx, PHP, and MariaDB base stack for CMS development on an Ubuntu VPS. It stops after the services are installed, hardened, and verified; it does not install WordPress or another CMS.
Run the commands from an account with sudo access. Before changing an existing server, confirm that you have a current backup and a tested recovery path. Virtarix VPS services are self-managed, so package maintenance, firewall rules, application installation, and recovery remain customer responsibilities.
Step 1: update package list
Begin by updating the package index:
sudo apt update
Step 2: install PHP and essential modules
Install PHP-FPM and the common modules needed by many PHP-based CMS applications:
sudo apt install -y php-fpm php-cli php-mysql php-xml php-gd php-curl
The CMS you choose may require additional extensions. Check its current requirements before installing the application.
Step 3: verify PHP installation and install Nginx
Verify the installed PHP version, then install Nginx:
php -v
sudo apt install -y nginx
Step 4: check Nginx installation and install MariaDB
Verify the Nginx package and install MariaDB:
nginx -v
sudo apt install -y mariadb-server
Step 5: secure MariaDB setup
Run MariaDB's interactive hardening utility:
sudo mariadb-secure-installation
Read each prompt rather than copying fixed answers. Authentication defaults can differ by MariaDB and Ubuntu release, and changing the database root authentication method without a reason can break local administration.
Step 6: configure MariaDB authentication and password
Keep an authentication method that you understand and can recover. On Ubuntu, local administrative access commonly uses Unix-socket authentication with sudo mariadb; do not replace it with password authentication merely to follow an old screenshot. If your environment requires database-root password authentication, store the credential securely and verify access before ending the session.
Step 7: finalize MariaDB security settings
Remove anonymous users and the test database unless a documented development requirement needs them. Restrict remote database-root access, reload privileges when prompted, and record any answer that differs from your team's standard.
Step 8: verify MariaDB access
Verify local administrative access and list the databases:
sudo mariadb
SHOW DATABASES;
EXIT;
Step 9: verify the base services
Confirm that Nginx and MariaDB are active and that PHP-FPM has an installed service unit:
sudo systemctl is-active nginx
sudo systemctl is-active mariadb
systemctl list-unit-files 'php*-fpm.service'
Also review sudo nginx -t, the listening sockets with sudo ss -lntp, and the host/provider firewall rules before exposing the server. Do not expose MariaDB publicly for a normal single-server CMS stack.
Next step: install your CMS
The base Nginx, PHP-FPM, and MariaDB environment is now installed, but no CMS, application database, virtual host, DNS record, or TLS certificate has been created. Continue with installing WordPress on this Nginx VPS.
Before installing any CMS, compare its current PHP extension, database-version, web-server, and filesystem-permission requirements with this base stack.