Skip to content
VdsRent
Intermediate12 min read

Run a production WordPress site behind NGINX

A working configuration for a single WordPress site on a balanced plan.

Last updated 1 August 2026

This guide assumes a fresh Ubuntu or Debian image on a plan with at least 4 GB of memory, and a domain already pointing at the server.

Install the stack

bash
apt update
apt install -y nginx mariadb-server php-fpm php-mysql php-curl php-gd php-xml php-mbstring

Create the database

sql
CREATE DATABASE wp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp'@'localhost' IDENTIFIED BY 'use-a-generated-password';
GRANT ALL ON wp.* TO 'wp'@'localhost';

Server block

nginx
server {
  listen 80;
  server_name example.com www.example.com;
  root /var/www/example.com;
  index index.php;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/run/php/php-fpm.sock;
  }
}

Certificates are not included

A TLS certificate is not bundled with a virtual server plan. Issue one yourself before you serve real traffic.

Before you go live

  • Enable a backup option on the service and confirm a restore works.
  • Restrict SSH to key authentication.
  • Set up log rotation for the NGINX access log.

Was this page useful?

Feedback about article wordpress-nginx
Run a production WordPress site behind NGINX — Guide — VdsRent