Using docker compose & WordPress to build a website

JJLAAA 2021-02-23 16:10:12
using docker compose wordpress build

Use docker-compose &WordPress Station building

install docker-compose

sudo curl -L "$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
  • If there's a network problem , Download executable file directly from browser /usr/local/bin Under the directory

Prepare the configuration file

  • by WordPress Provide HTTPS Supported by Nginx The configuration file

    mkdir -p /root/wordpress/nginx/conf && mkdir -p /root/wordpress/nginx/ssl \
    echo 'server {
    listen 80;
    server_name ${host_name};
    rewrite ^(.*)$ https://${host_name}$1 permanent;
    server {
    listen 443 ssl;
    server_name ${host_name};
    #ssl Certificate file location ( The common certificate file format is :crt/pem)
    ssl_certificate /etc/nginx/ssl/cert.pem;
    #ssl certificate key Location
    ssl_certificate_key /etc/nginx/ssl/cert.key;
    ssl_session_timeout 10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    location / {
    proxy_pass http://wordpress;
    proxy_cache_bypass $http_upgrade;
    # Proxy headers
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Port $server_port;
    # Proxy timeouts
    proxy_connect_timeout 600s;
    proxy_send_timeout 600s;
    proxy_read_timeout 600s;
    }' >> /root/wordpress/nginx/conf/route.conf
    • Certificates can be applied for free from alicloud , Bind to the corresponding ${host_name} Domain name is enough , And put it to /root/wordpress/nginx/ssl/ Under the table of contents ( Free to modify , Pay attention to the following yaml Just keep the file consistent )
  • docker-compose yaml The configuration file

    echo 'version: '3.1'
    image: nginx
    container_name: wp_nginx
    restart: always
    - 443:443
    - 80:80
    - /root/wordpress/nginx/conf:/etc/nginx/conf.d/
    - /root/wordpress/nginx/ssl/:/etc/nginx/ssl/
    image: wordpress
    container_name: wp
    restart: always
    - wordpress:/var/www/html
    image: mysql:5.7
    container_name: wp_mysql
    restart: always
    MYSQL_USER: wp
    MYSQL_PASSWORD: wp_db_lee
    - db:/var/lib/mysql
    db:' >> /root/wordpress/wordpress.yaml \
    docker-compose -f wordpress.yaml up -d

Configure network and domain name

  • Just in the domain name provider , Domain name purchased for yourself , add to A Type of subdomain record, such as, Then set the resolution value to the public network of your own server IP that will do

Plug ins are recommended

  • All-in-One WP Migration Migration site
  • Post Views Counter Look at the number of readings
  • UpdraftPlus- Backup / recovery Backup site
  • WP Githuber MD Markdown Online editing
  • Yoast SEO SEO Set up

Plug in installation issues

  • When there is a network error in plug-in installation , You can go to the official website of the plug-in , Manually download the file and upload it to the specified folder for installation , Use docker cp The command is imported into the container .
  • Note that after importing , Enter the... Of the file or folder that the container will import owner And group And others WordPress The documents are consistent

  1. Deep understanding of Web protocol (3): http 2
  2. Tencent IEG open source AI SDK: automatic testing of chicken eating and MoBa games
  3. Mysql Command
  4. Docker dockerfile create image
  5. Redis Cluster
  6. 死磕Spring之IoC篇 - 文章导读
  7. Deep understanding of Web protocol (3): http 2
  8. JavaScript BOM operation
  9. JavaScript BOM operation
  10. 死磕Spring之IoC篇 - 文章导读
  11. k8s node 操作与维护
  12. k8s 证书更新
  13. 【Java面试题第三期】JVM中哪些地方会出现内存溢出?出现的原因是什么?
  14. HashMap连环问你能答出几道?
  15. k8s-cronjob
  16. k8s-cert
  17. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  18. 什么是HTTPS以及如何实施HTTPS?
  19. Spring: an introduction to IOC
  20. Spring: an introduction to IOC
  21. Operation and maintenance of k8s node
  22. K8s certificate update
  23. vue使用sdk进行七牛上传
  24. k8s-dns
  25. JavaScript 邮箱验证 - 正则验证
  26. k8s-dashboard
  27. HashMap连环问你能答出几道?
  28. Where does memory overflow occur in the JVM? What are the reasons for this?
  29. How many questions can you answer?
  30. k8s-cronjob
  31. spring注解--Transactional
  32. k8s-cert
  33. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  34. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  35. 【k8s集群】搭建步骤
  36. k8s-kubeadm
  37. k8s-etcd
  38. What is HTTPS and how to implement it?
  39. Java中使用HashMap改进查找性能
  40. maven发布jar包运行时找不到类问题
  41. J2EE
  42. Vue uses SDK to upload seven cows
  43. k8s-dns
  44. JavaScript mailbox verification - regular verification
  45. k8s-dashboard
  46. How many questions can you answer?
  47. Spring annotation -- transactional
  48. [k8s cluster] construction steps
  49. k8s-kubeadm
  50. k8s-etcd
  51. Using HashMap to improve search performance in Java
  52. There is no class problem when Maven publishes jar package
  53. JavaScriptBOM操作
  54. J2EE
  55. k8s-prometheus-memory
  56. k8s-prometheus disk
  57. k8s-prometheus
  58. JavaScript BOM operation
  59. k8s-prometheus-memory
  60. k8s-prometheus disk