cause I once set up WordPress on Vultr, but for well-known reasons, the access to this place became slower and slower. Later, I chose Sina Cloud. Sina Cloud is indeed cheap and good, but it requires registration and the comment function is probably going to be removed. After thinking about it, I decided to give up and just find a host in Hong Kong to build WordPress. Buy Hosting I have chosen Alibaba Cloud's lightweight application server. The advantage of this host is that it is cheap and sufficient. The configuration is as follows Initialize the Docker environment Although there is a function to install wordpress above, I don’t recommend it because the configuration is too old. In the end, I chose the Ubuntu 18.04 system. I can install docker and initialize docker swarm directly with the following command: curl -o- -L https://gist.githubusercontent.com/hangox/e679464f35dc2a78920e6249a21d7958/raw/c5541e38979dca1e3e1e9704ad171ed2f0556fa1/ubunut-install-docker.sh | bash Writing docker-compose Configuration Overview version: '3.7' services: caddy: image: abiosoft/caddy ports: - 80:80 -443:443 environment: - ACME_AGREE=true - TZ=Asia/Shanghai volumes: - caddy:/root/.caddy - wp-src:/usr/src/wordpress configs: - source: wp_caddy target: /etc/Caddyfile app: image: wordpress:5.4.1-php7.2-fpm environment: TZ: Asia/Shanghai WORDPRESS_DB_HOST: wp_db:3306 WORDPRESS_DB_USER: root WORDPRESS_DB_PASSWORD: yourpassword WORDPRESS_DB_NAME: wordpress depends_on: -db volumes: - wordpress:/var/www/html - wp-src:/usr/src/wordpress db: image:mysql:8 environment: TZ: Asia/Shanghai MYSQL_ROOT_PASSWORD: yourpassword MYSQL_DATABASE: wordpress command: --default-authentication-plugin=mysql_native_password volumes: -db:/var/lib/mysql volumes: wordpress: db: caddy: wp-src: configs: wp_caddy: external: true Configuration parsing caddy Used as a reverse proxy, while taking into account https certificate application, the configuration is as follows https://47log.com https://www.47log.com root /usr/src/wordpress gzip fastcgi/wp_app:9000php rewrite { if {path} not_match ^\/wp-admin to {path} {path}/ /index.php?_url={uri} } log stdout errors stderr } Here I used the config function of docker swarm and wrote the configuration directly into the wp_caddy configuration. db MySQL8 is used here, which is supported by wordpress and has better performance. It should be noted that the command must be added with command: --default-authentication-plugin=mysql_native_password, otherwise password authentication will not be possible. I just forgot to add this and it was a pain for a while. app Pay attention to the connection method. If you are deploying with docker stack, you need to add a prefix to the name of the deployment. For example, here I use docker stack deploy -c docker-compose.yml wp, and the host of my database in the docker network is wp_db. If your stack name is wordpress, you should change it to wordpress_db accordingly. Note: Configure volume Deploy using docker stack One line of command Why use docker swarm. Because of portainer, docker-swarm can have full-featured configuration capabilities after being connected to portainer. This is the end of this article about how to use Docker Swarm to build WordPress. For more information about how to use Docker Swarm to build WordPress, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: WiFi Development | Introduction to WiFi Wireless Technology
>>: Native JS realizes compound motion of various motions
I designed and customized a navigation bar with a...
First look at the effect: When the mouse moves ov...
The effect is as follows: a page After clicking t...
Table of contents 1. What is the use of provide/i...
Table of contents 1. Mutex 1. Initialization of m...
Preface: MySQL master-slave architecture should b...
This article shares the specific code of jQuery t...
The MySQL database does not have an incremental b...
Table of contents background LIMIT Optimization O...
<br />It has been no more than two years sin...
Recently I used MySQL to export table data to an ...
This article will introduce how to use explain to...
Table of contents Advantage 1: Optimization of di...
Background Replication is a complete copy of data...
Delayed loading (lazy loading) and preloading are...