It becomes so easy to host a WordPress CMS using its official Docker container image. If only 1 domain is available, it might be useful to serve WordPress from subdirectory, i.e https://$SITE_URL/blog/
.
First, follow the official documentation (Method II) to setup WordPress installation in subdirectory.
$ export SUBPATH="blog"
$ mv !($SUBPATH) $SUBPATH/
$ cp SUBPATH/index.php index.php
$ sed -i "s/wp-blog-header.php/$SUBPATH\/wp-blog-header.php/g"
Then configure Traefik label:
version: '3'
services:
wordpress:
....
labels:
- 'traefik.enable=true'
- 'traefik.http.routers.blog.rule=Host(`$SITE_URL`) && PathPrefix(`/blog`)'
- 'traefik.http.routers.blog.entrypoints=https'
....
- 'traefik.http.routers.blog.tls=true'