Docker compose to set up containers
See docker compose https://github.com/kasakun/wordpress-nginx-docker.
Nginx is the front end, in the mean time Wordpress and mysql serve as a standalone server. This gives me ability to add more service in future easily.
Before starting the container with docker-compose, we need to edit .env to customize data and ssl location. Sometimes we need chmod permission for this folders for Wordpress to write in.
docker-compose up -d # start all containers
docker-compose down # stop all containers
docker logs wp-* # check containers' logs to understand it works correctly
Auto SSL
Here we use acme script from https://github.com/acmesh-official/acme.sh
After installation, we can go ahead to verify the domain and the server that we need to specify the server webroot in the command
acme.sh --issue -d example.com -d www.example.com -d cp.example.com -w $WEBROOT
The $WEBROOT is somehow defined in the .env above. After running this command, it will issue a certificate and meanwhile set up a cron job. This can be checked by
crontab -l
文章评论