Run Wordpress using swag
Install docker and docker-compose⌗
I use Arch btw, so: sudo pacman -S docker docker-compose
Enable the docker daemon sudo systemctl enable docker
and start it sudo systemctl start docker
.
Add your user to the docker group: sudo usermod -a -G groupname username
Create a docker-compose.yaml
file, fill it with content as per instructions from LinuxServer.IO
version: "2.1"
services:
mariadb:
image: lscr.io/linuxserver/mariadb
container_name: mariadb
environment:
- PUID=1000
- PGID=1000
- MYSQL_ROOT_PASSWORD=${mariadbpassword}
- TZ=Europe/Amsterdam
- MYSQL_DATABASE=WP_database
- MYSQL_USER=WP_dbuser
- MYSQL_PASSWORD=${WP_dbpassword}
volumes:
- ./mariadb:/config
restart: unless-stopped
swag:
image: lscr.io/linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Amsterdam
- URL=test.domain.com
# - SUBDOMAINS=wildcard
- VALIDATION=http
# - DNSPLUGIN=cloudflare
volumes:
- ./swag:/config
ports:
- 443:443
- 80:80
depends_on:
- mariadb
restart: unless-stopped
I keep my passwords in .env file, I had issues because one contained a “$”, I removed it from the password.
Pull the containers
docker-compose pull
and start them
docker-compose up -d
You should find the test page including https at the given domain.
Now follow the instructions again, first we need wget though sudo pacman -S wget
, then cd swag/www
, wget the latest Wordpress wget https://wordpress.org/latest.tar.gz
, unpack it tar xvf latest.tar.gz
, open /swag/nginx/site-confs/default
(here I deviated from the instructions, I put the folder somewhere else), change the line root /config/www;
to root /config/www/wordpress;
. Restart swag docker-compose restart
(execute in the folder where the docker-compose.yaml file is).
To get nice permalinks, one needs to edit swag/nginx/default.conf
, change the line:
try_files $uri $uri/ /index.html /index.php$is_args$args =404;
to
try_files $uri $uri/ /index.php?$args;
That should do it.