Files
wordpress-ubuntu/README.md
2025-11-29 13:54:50 +01:00

3.7 KiB
Raw Blame History

WordPress on Ubuntu 24.04

OS Shell WebServer PHP MariaDB MySQL App License

Automated installer for the latest stable WordPress on Ubuntu 24.04, configured for Nginx, PHP-FPM, and MariaDB/MySQL.

This is not a 5-minute “demo stack”.
This script deploys a production-ready WordPress site, database included, configs hardened, and Nginx validation enforced.

Install → Configure → Visit /wp-admin/install.php → Done.


Prerequisites

This script expects:

✔ Nginx installed
✔ PHP-FPM installed
✔ MariaDB/MySQL running (socket or password mode supported)

Optional Installers (if you need them — saves you some googling)


1. Download

git clone https://git.x-files.dk/webapps/wordpress-ubuntu.git
cd wordpress-ubuntu

2. Install WordPress

sudo ./wordpressinstall -n <domain> -d <dbname> -u <dbuser> -p <dbpass> [options]

Examples

Socket authentication detected → simple command:

sudo ./wordpressinstall -n wp.example.com -d wpdb -u wpuser -p wpPass123

Socket unavailable → add database credentials manually:

sudo ./wordpressinstall -n wp.example.com -d wpdb -u wpuser -p wpPass123 -m rootpwd
sudo ./wordpressinstall -n wp.example.com -d wpdb -u wpuser -p wpPass123 -a admin -m adminpwd

Options

Flag Meaning
-m <password> MariaDB/MySQL admin or root password (only if socket OFF)
-a <username> DB admin username (defaults to root)
-h / --help Show help

What this installer does

✔ Downloads + configures latest WordPress
✔ Creates DB + DB-user if they dont exist
✔ Generates Nginx host file automatically
✔ Detects socket vs password auth
✔ Validates Nginx (nginx -t) before reload
✔ Supports safe re-runs
✔ Built for production, not testing


After installation

Visit:

http://<domain>/wp-admin/install.php

Complete the setup wizard — database already wired.


File & Config Layout

Path Purpose
/var/www/html/<domain> WordPress directory
/etc/nginx/conf.d/<domain>.conf Virtualhost config
/etc/nginx/conf.d/includes/wp-hardening.conf Security
/etc/nginx/conf.d/wp-rate-limit.conf Rate limit

HTTPS Support (443)

Enable TLS using:

https://git.x-files.dk/webserver/nginx-snippets/src/branch/main/hostfiles/wordpress.443.conf

Caching snippets (disabled until uncommented):

# include /etc/nginx/nginx-snippets/cache-open-files.conf;
# include /etc/nginx/nginx-snippets/cache-statics.conf;
# include /etc/nginx/nginx-snippets/cache-js-css.conf;

Troubleshooting

Issue Cause Fix
Nginx restart fails Config error nginx -t
DB denied No socket auth Use -m
PHP errors Wrong FPM version Check php8.3-fpm

More Information

More guides and documentation can be found on wiki.x-files.dk


License

Licensed under the MIT License.