I currently have wordpress running in docker, which I’ve been told is self-updating (dubious, but maybe). And then am using nginx to reverse proxy it.
This is my docker-compose.yaml for anyone interested:
services:
wordpress:
image: wordpress
restart: always
ports:
- 8083:80
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wordie
WORDPRESS_DB_PASSWORD: NotMyRealPassword
WORDPRESS_DB_NAME: wordpress
volumes:
- wordpress:/var/www/html
db:
image: mysql:8.0
restart: always
environment:
MYSQL_DATABASE: wordpress
MYSQL_USER: wordie
MYSQL_PASSWORD: NotMyRealPassword
MYSQL_RANDOM_ROOT_PASSWORD: '1'
volumes:
- db:/var/lib/mysql
volumes:
wordpress:
db:
And here is the relevant part of my nginx configuration:
server {
if ($host = localhost:8080/) {
return 301 https://$host$request_uri;
}
server_name localhost:8080/;
listen 80;
listen [::]:80;
return 404;
}
server {
server_name localhost:8080/;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /etc/letsencrypt/livelocalhost:8080/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/livelocalhost:8080/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8083;
proxy_redirect off;
}
}
Truth be told, some of those headers might not be needed. I just copied them from some other subdomains.
The more important thing to do is change your wordpress settings in Settings>General to point to the right domain. I wasted a few minutes figuring that out.
Anyway, good luck and have fun!
Leave a Reply