Skip to main content
Setting Up a CMS Web Development Environment on a VPS - Virtarix Blog

Setting Up a CMS Web Development Environment on a VPS

November 15, 2024 · Blog / Technical Guides

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:

Update the Ubuntu package index
sudo apt update

Ubuntu terminal showing package-list update output

Step 2: install PHP and essential modules

Install PHP-FPM and the common modules needed by many PHP-based CMS applications:

Install PHP-FPM and common CMS modules
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.

Ubuntu terminal showing PHP and module installation output

Step 3: verify PHP installation and install Nginx

Verify the installed PHP version, then install Nginx:

Verify PHP and install Nginx
php -v
sudo apt install -y nginx

Terminal confirming the installed PHP version before Nginx installation

Step 4: check Nginx installation and install MariaDB

Verify the Nginx package and install MariaDB:

Verify Nginx and install MariaDB
nginx -v
sudo apt install -y mariadb-server

Terminal showing Nginx installation before MariaDB setup

Step 5: secure MariaDB setup

Run MariaDB's interactive hardening utility:

Start the MariaDB 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.

MariaDB secure-installation prompt requesting the database root password

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.

MariaDB secure-installation prompts for root authentication and password settings

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.

MariaDB secure-installation prompts removing anonymous users and the test database

Step 8: verify MariaDB access

Verify local administrative access and list the databases:

Verify MariaDB administrative access
sudo mariadb
SHOW DATABASES;
EXIT;

MariaDB monitor showing the available databases

Step 9: verify the base services

Confirm that Nginx and MariaDB are active and that PHP-FPM has an installed service unit:

Verify the Nginx, MariaDB, and PHP-FPM services
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.

MariaDB monitor confirming the final database check

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.

Frequently asked questions

What are the basic system requirements for setting up this environment?

Use a supported Ubuntu release, an administrative account with sudo, enough storage for the operating system, packages, logs, database, application files, and backups, and a tested recovery path. Size CPU and memory from the chosen CMS, extensions, traffic, database, and development workload rather than a universal minimum.

What should I do if the installation of Nginx or MariaDB fails?

Read the exact package-manager error first. Confirm repository and network access, available disk space, and whether another package operation holds the lock. Do not run a broad upgrade as a generic reaction; resolve the identified cause and retry the failed package operation.

How do I check if PHP, Nginx, and MariaDB are running correctly?

Use php -v for the CLI version, inspect the PHP-FPM service unit, run sudo nginx -t, and check systemctl is-active for Nginx and MariaDB. A running service is only the base check; the later CMS guide must also verify PHP execution, database access, virtual-host routing, DNS, and TLS.

Is it necessary to configure the MariaDB security settings, and what do they do?

Yes. The interactive utility helps remove anonymous access and test data and restrict administrative access. Read the prompts for your installed release and preserve a working, recoverable local administrative login; do not force password authentication when the server is intentionally using Unix-socket authentication.

Ready to build a CMS development environment on Virtarix VPS?

Compare self-managed VPS sizes for CMS projects, web servers, databases, and staging sites with root access, NVMe storage, IPv4 + IPv6 and one snapshot.

VPS S

For small websites and landing pages

$ 5 .50 /month
  • 3 cores
  • 6 GB
  • 50 GB NVMe
  • Unlimited
Get It Now
BEST SELLER

VPS M

For growing sites and staging

$ 11 .40 /month
  • 6 cores
  • 16 GB
  • 100 GB NVMe
  • Unlimited
Get It Now
Peter French
About the Author Peter Frenchis the Managing Director at Virtarix, with over 17 years in the tech industry. He has co-founded a cloud storage business, led strategy at a global cloud computing leader, and driven market growth in cybersecurity and data protection.