Managed WordPress hosting charges per site and hides the knobs. On your own VPS you get the whole server, as many sites as it can hold, and full control over PHP and caching. The classic stack — Nginx, PHP-FPM, MariaDB — installs in about fifteen minutes on Ubuntu 24.04.
Before you start: you need a plan with a dedicated IP (visitors connect to ports 80/443; NAT plans don't accept inbound web traffic) and a domain whose A record points at the server. Micro-IP at $10/month is a comfortable home for a normal site.
1. Install the stack
apt update
apt install -y nginx mariadb-server php8.3-fpm php8.3-mysql php8.3-curl \
php8.3-gd php8.3-intl php8.3-mbstring php8.3-xml php8.3-zip
2. Create the database
MariaDB on Ubuntu lets root in through the local socket, no password needed:
mariadb <<'SQL'
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'wp'@'localhost' IDENTIFIED BY 'use-a-long-random-password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp'@'localhost';
FLUSH PRIVILEGES;
SQL
3. Download WordPress
cd /tmp && curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
mv wordpress /var/www/example.com
chown -R www-data:www-data /var/www/example.com
4. Configure Nginx
cat > /etc/nginx/sites-available/example.com <<'EOF'
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.php;
client_max_body_size 64M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
location ~ /\.(?!well-known) { deny all; }
}
EOF
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
rm -f /etc/nginx/sites-enabled/default
nginx -t && systemctl reload nginx
The try_files line is what makes pretty permalinks work — the Nginx equivalent of WordPress's .htaccess rules.
Raise PHP's upload limit to match client_max_body_size:
sed -i 's/^upload_max_filesize.*/upload_max_filesize = 64M/; s/^post_max_size.*/post_max_size = 64M/' /etc/php/8.3/fpm/php.ini
systemctl restart php8.3-fpm
5. Free HTTPS
apt install -y certbot python3-certbot-nginx
certbot --nginx -d example.com -d www.example.com
Certbot edits the Nginx config for HTTPS and sets up automatic renewal.
6. Finish in the browser
Open https://example.com, enter the database name (wordpress), user (wp) and password from step 2, and create your admin account. Pick an admin username that isn't "admin".
Keep it fast and safe
- Firewall:
ufw allow 22/tcp && ufw allow 'Nginx Full' && ufw enable. - Updates: enable automatic updates for WordPress core in the dashboard, and automatic security updates for the server.
- Caching: a page-cache plugin makes more difference than any server tweak on a small box.
- Backups: Managed Backups keep daily restore points of the whole server ($2/mo, free on annual plans). For a portable copy, add
mysqldump wordpress > wp.sqlplus thewp-contentfolder. - Memory: on 1 GB servers add a 2 GB swap file.
Related
- VPS for a website
- Nginx reverse proxy with HTTPS
- VPS for Plausible analytics — cookie-free stats for your site
Comments
No comments yet. Be the first.