customization - Multiple Wordpress sites with docker

admin2025-06-02  1

I want to host multiple independent wordpress sites (4-10) on a rootserver. I want to host them using docker containers. Now the Q: Is it better to run ONE mysqldb running all wordpress schemes for the multiple sites, or is ist better to run one mysql instance per wordpress. Thank you. N.

I want to host multiple independent wordpress sites (4-10) on a rootserver. I want to host them using docker containers. Now the Q: Is it better to run ONE mysqldb running all wordpress schemes for the multiple sites, or is ist better to run one mysql instance per wordpress. Thank you. N.

Share Improve this question asked Oct 9, 2016 at 8:28 nirocknirock 511 silver badge3 bronze badges 1
  • Depends on the size of your DB and if each site is a multisite with more sites. If they all need to access the same data then sharing a database would be nice. But for perf, go with separate DBs. – jgraup Commented Nov 17, 2016 at 4:14
Add a comment  | 

3 Answers 3

Reset to default 2

Following Docker's philosophy of "one application per container" you should have a database container for each WordPress instance. This way each database is isolated from the others. Should anything happen to one database it will not affect the others. Also, if you want to migrate or take down one website you only need to act upon its containers.

The official WordPress image is prepared to link to another container providing a database. Therefore you will have two containers per website: one for the WordPress files and another for the database. For the databases you might use the official MariaDB image.

The traffic for the several WordPress containers might then be distributed by a proxy container such as this one.

I saw something that may help you. Click here to see : http://donalfarrell/2015/08/11/Docker-Nginx-Multi-Wordpress.html

Basically you need to use reverse proxy to resolve this problem and you can use the 'link' property do sync your web application with specific database container. Nginx container to do reverse proxy, may be a good solution for you.

I hope it helps =)

If you don't have resource problem then create a docker-compose file per WordPress with a MySQL container per WordPress. Apps will be isolated, if not you can have some problems if you use one MySQL db container for all sites

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748815926a313956.html

最新回复(0)