You've already forked wordpress-ubuntu
164 lines
4.1 KiB
Markdown
164 lines
4.1 KiB
Markdown
|
|
# WordPress for Ubuntu 24.04
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](#)
|
|||
|
|
[](./LICENSE)
|
|||
|
|
|
|||
|
|
Install WordPress on Ubuntu 24.04 server.
|
|||
|
|
|
|||
|
|
This is not a demo and not an experiment.
|
|||
|
|
A production-focused installer — correct permissions, prepared DB, no web-based setup guessing.
|
|||
|
|
|
|||
|
|
## Why this installer exists
|
|||
|
|
Most WordPress guides leave insecure permissions, unclear DB setup and missing caching. This avoids all three.
|
|||
|
|
|
|||
|
|
## What this installer does
|
|||
|
|
✔ Downloads the latest WordPress release
|
|||
|
|
✔ Creates database + user automatically
|
|||
|
|
✔ Generates validated Nginx host config
|
|||
|
|
✔ Socket or password authentication supported
|
|||
|
|
✔ Safe to re-run without data loss
|
|||
|
|
|
|||
|
|
## What this installer does *NOT* do
|
|||
|
|
It won’t stop you from running the script without reading the documentation like there’s no tomorrow.
|
|||
|
|
Skip the README, and whatever happens next is your headache, not a bug report.
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 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)
|
|||
|
|
|
|||
|
|
- [Install Nginx + PHP-FPM on Ubuntu](https://git.x-files.dk/webserver/nginx-ubuntu)
|
|||
|
|
- [Install MariaDB on Ubuntu](https://git.x-files.dk/database/mariadb-ubuntu)
|
|||
|
|
- [Install MySQL on Ubuntu](https://git.x-files.dk/database/mysql-ubuntu)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 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 don’t 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](https://wiki.x-files.dk)
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
### License
|
|||
|
|
Licensed under the [MIT License](./LICENSE).
|
|||
|
|
|
|||
|
|
---
|