AdnanHodzic / containerized-wordpress-project

Automagically deploy & run WordPress with Let's Encrypt HTTPS encryption using Ansible & Docker
https://foolcontrol.org/?p=2002
GNU General Public License v3.0
42 stars 22 forks source link

Multiple virtual hosts per box #5

Closed avidsapp closed 4 years ago

avidsapp commented 5 years ago

Any pointers on being able to add more virtual hosts (subdomains) via Ansible?

AdnanHodzic commented 5 years ago

I have a ToDo item for this project to extend it and add support for additional virtual hosts.

Reason why I haven't automated this yet (besides lack of time) is that, everyone's additional virtual hosts use will vary. For example, does a person want this virtual hosts file for:

I personally have additional virtual hosts which I use, and would also benefit of implementing this feature. But at this point I just deploy it manually.

avidsapp commented 5 years ago

Fair enough. I also manually implement additional virtual hosts. I have a few separate use cases. Ideally:

  1. Subdomains for the same TLD that use one central db container for multiple wordpress containers. Let's Encrypt for all subdomains
  2. Multiple TLDs with separate wordpress and db containers. Let's Encrypt for all domains.

I'm new to Ansible, but I can share as I figure out how to automate these.

AdnanHodzic commented 5 years ago

Subdomains for the same TLD that use one central db container for multiple wordpress containers. Let's Encrypt for all subdomains

Agreed, this is definitely a case scenario which most of the users would find useful. Same case is with Multiple TLDs with separate wordpress and db containers. Let's Encrypt for all domains..

I can do this when I have free time, but I'd definitely encourage you to try this yourself based on what I did with this role and project itself. Just see how I pass changes and how nginx configs are written, then extend it and build on top of that. I'd say to work on "1. subdomains" changes first, as it's relatively simple task.

If you manage to get anything done, please submit a Pull request which I'd be more than happy to review and pull in with master.

avidsapp commented 5 years ago

Sure thing. I plan to extend when I get time.

I realized the catch-all subdomain doesn't redirect on AWS. Incorporating those Nginx blocks would be first priority.

AdnanHodzic commented 4 years ago

With latest changes, you're able to create as many subdomains as you want.

For example, as part of deployed docker-compose.yml file simply extend it to:

DOMAINS: foolcontrol.org -> http://wordpress:80, test.foolcontrol.org -> http://wordpress:80'

This will allow you to add as many subdomains as necessary.

avidsapp commented 4 years ago

That's great news. Are these subdomains multisite compatible?

AdnanHodzic commented 4 years ago

Yes, they are. In this case, if you have multisite as part of docker-compose file, simply point different domain to different wordpress instance.

With this said, I'm going to close this issue. If you have this or similar issue, please submit a new issue or re-open this one.