In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you the use of Docker Swarm to build Wordpress cases, I hope you will learn something after reading this article, let's discuss it together!
Using Docker Swarm to build the cause of Wordpress
I used to build wordpress on Vultr, but for well-known reasons, access to this place is getting slower and slower. Later, I chose Xinlangyun. Xinlangyun is indeed cheap and good, but it is necessary to put it on record and the comment function is estimated to be castrated. Just think about it and find a host in Hong Kong to build wordpress.
Purchase the mainframe
What I choose here is Aliyun's lightweight application server. The advantage of this host is that it is cheap and sufficient.
For example, the host I choose in Hong Kong costs only 24 yuan a month, one core and one gigabyte of memory, the network speed is 30Mbps, disk space 25GB, and monthly traffic 1TB.
The configuration is as shown below
Initializing the docker environment although there is a feature to install wordpress, but I do not recommend it, because the configuration is too old
In the end, I chose the ubuntu18.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
Write docker-compose configuration at a glance: '3.7'services: caddy: image: abiosoft/caddy ports:-80:80-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/mysqlvolumes: wordpress: db: caddy: wp-src:configs: wp_caddy: external: true configuration parsing caddy
Used as a reverse proxy, while taking into account the https certificate application, the configuration is as follows
Https://47log.com https://www.47log.com {root / usr/src/wordpress gzip fastcgi / wp_app:9000 php rewrite {if {path} not_match ^\ / wp-admin to {path} {path} / / index.php?_url= {uri}} log stdout errors stderr}
Here I use the config feature of docker swarm to write the configuration directly to the wp_caddy configuration.
Db
Mysql8 is used here, wordpress is supported, and the performance is better.
It should be noted that commmand must add command:-- default-authentication-plugin=mysql_native_password or there is no way to authenticate the password. I just forgot to add this egg and it hurt for a while.
App
Pay attention to the connection mode
If you are deploying with docker stack, what name is deployed, the database connection should be prefixed with the name. For example, here is 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, change it to wordpress_db.
Pay attention to configuring volume
-wordpress:/var/www/html this thing must be configured, last time I did not configure this thing, delete container, the theme is directly gone.
Deploy using docker stack
One-line command docker stack deploy-c docker-compose.yml wp will be able to enter wordpress after a while
Why use docker swarm. Because of portainer, docker-swarm can be configured with full function after it is connected to portainer. After reading this article, I believe you have a certain understanding of "the case of using Docker Swarm to build Wordpress". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.