Home > CMS Tutorial > WordPress > Use docker to build wordpress

Use docker to build wordpress

藏色散人
Release: 2019-09-21 10:10:06
forward
5564 people have browsed it

The following column WordPress Tutorial will introduce how to use docker to build wordpress. I hope it will be helpful to friends in need!

Use docker to build wordpress

Introduction

This is not a formal article about setting up wordpress, it is based on the previous article On the basis of implementation. The final implementation is to use nginx as a proxy, an independent wordpress container, and MySQL connected to laradock as storage.

Modify nginx proxy

Compared with laradock's configuration, you only need to modify the listening domain name and forwarded port. 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://[宿主机IP]:8001;
    }
}
Copy after login

Remember to restart after modification

Build the wordpress container

1. Pull the image docker pull wordpress

2. Because wordpress needs to connect to the MySQL container, laradock happens to be available, so just use this. The connection method does not use --link, use --network. You can refer to the MySQL network in

3.laradock, which is written in the docker-compose.yml file, as follows

Use docker to build wordpress

At the same time, use docker network ls to view, and you can see the laradock_backend network. Obviously you can use laradock_backend

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

2. The last step is to start the server (host) Port 8001

Conclusion

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

The above is the detailed content of Use docker to build wordpress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template