Get the App
SLTechnology News&Howtos  ›  Servers  › 

The method of using docker to build wordpress

Shulou Source: shulou.com Published: 2022-06-02 01:44:38 09月28日 Update

This article will explain in detail how to use docker to build wordpress. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Introduction

This is not a formal wordpress building article, but based on the previous article, the implementation. The final implementation is to use nginx as a proxy, an independent wordpress container, and connect the MySQL of laradock to do storage.

Modify nginx Agent

Compared with the configuration of laradock, it only modifies the domain name for listening and the port for forwarding. Create a new wordpress.conf file in the / etc/nginx/conf.d/ directory as follows

Server {listen 80; server_name blog.you_site.com; location / {proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://[ host IP]: 8001;}}

Remember to restart after modification

Set up a wordpress container

1. Pull image docker pull wordpress

two。 Because wordpress needs to connect to the MySQL container, which happens to be available in laradock, just use this. The way to connect does not need-- link, use-- network, you can refer to here

The network of MySQL in 3.laradock is written in the docker-compose.yml file, as follows

At the same time, using docker network ls to view, you can see the laradock_backend network. It is obvious that you can use laradock_backend.

1. Build the container docker run-d-- name wordpress-p 8001 network laradock_backend wordpress 80-- network laradock_backend wordpress

two。 The last step is to open the server (host) port 8001

Conclusion

Open the URL and the configuration interface appears. Just set Database Host to mysql. Other data sheets, users, etc., are not within the scope of discussion.

On the use of docker to build wordpress method to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Container method host host file article more port article agent reference configuration good practical formal obvious this is not no content just Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Linux MariaDB Huawei