<p>I am refactoring my local environment from MAMP-pro to PHP/apache/Docker.</p>

<p>What is the proper configuration to implement a reverse proxy (in order to maintain the named-url site functionality of MAMP-pro) in this environment without the use of third party tools (IE Caddy server or NGINX)</p>

<p>My goal is to have a bunch of Docker Apache/PHP containers running at once, each running one application that is accessible by a named URL. </p>

CC BY-SA 3.0
2017-12-30T10:45:11.983Z
What did you try?
030
CC BY-SA 3.0
2017-12-31T02:05:28.957Z
So you want an apache-based reverse proxy?  https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html  https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension
chicks
CC BY-SA 3.0
2018-01-03T15:18:13.470Z
@030 things that would work locally, before realizing that adding sites to the hosts file on the container would help at all
Btuman
CC BY-SA 3.0
2018-01-03T15:18:45.073Z
@chicks yup, I do. I read both of those articles, but cannot make either work with docker
Btuman
CC BY-SA 3.0
2018-01-03T17:26:33.740Z
I can't make something from this question, mamp stand for Mac Apache Mysql Php, what are you willing to do in docker? The automatic dns/vhost Config has nothing to do with that, it's scripts/tooling included in mamp you will have to replace but there's no final goal here...
Tensibai
CC BY-SA 3.0
2018-01-03T20:19:50.403Z
@Tensibai Mamp does indeed stand for that. Mamp pro is a bit of software that, among other other things, allows for multiple sites to be run locally with custom URLs. I am seeking a way to replicate that: IE run all my sites on docker with those custom local URLs
Btuman
CC BY-SA 3.0
2018-01-03T20:23:18.230Z
I have edited the question to make it more clear
Btuman
CC BY-SA 3.0
2018-01-03T20:29:14.583Z
Use traefik to route them, moving to docker change the paradigm, you'll probably need an orchestration layer like k8s (look for minikube for a dev station) or swarm to tell traefik about the containers running so it can self configure to route to them by hostname
Tensibai
CC BY-SA 3.0
2018-01-03T20:31:29.300Z
BTW my remark about mamp is that you're asking in the title for php apache Mac Apache Mysql Php (it's redundant and badly worded, it has been better to drop a word about what mamp is than dropping words   side by side)
Tensibai
CC BY-SA 3.0
2018-01-03T21:00:44.237Z
@Tensibai I notice that you are suggesting a third party tool, is there a reason for that? Is there a reason that I cannot do this with apache docker containers?
Btuman
CC BY-SA 3.0
2018-01-03T22:35:38.033Z
You can reinvent the wheel as much as you wish, something will have to ask docker daemon for containers and then write apache vhost configuration to proxy to containers, that's a lot of work and a bunch of people are already doing it in an open source way, I see no reasons to not use it.
Tensibai
CC BY-SA 3.0
2018-01-03T22:41:12.483Z
(btw if you put this into an answer with detail I will accept it) Fascinating, I wonder why something that seems so basic isn't already baked in
Btuman
<docker><php>
Configuration for reverse proxies in a local Docker/Apache/PHP environment
Btuman
# Configuration for reverse proxies in a local Docker/Apache/PHP environment

(Asked by: username_0 on 2017-12-28)

I am refactoring my local environment from MAMP-pro to PHP/apache/Docker.

What is the proper configuration to implement a reverse proxy (in order to maintain the named-url site functionality of MAMP-pro) in this environment without the use of third party tools (IE Caddy server or NGINX)

My goal is to have a bunch of Docker Apache/PHP containers running at once, each running one application that is accessible by a named URL.

**Tags:** docker, php

> **Comments:**
> **username_1**: What did you try?  
> **username_2**: So you want an apache-based reverse proxy?  https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html  https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension  
> **username_0**: @username_1 things that would work locally, before realizing that adding sites to the hosts file on the container would help at all  
> **username_0**: @username_2 yup, I do. I read both of those articles, but cannot make either work with docker  
> **username_3**: I can't make something from this question, mamp stand for Mac Apache Mysql Php, what are you willing to do in docker? The automatic dns/vhost Config has nothing to do with that, it's scripts/tooling included in mamp you will have to replace but there's no final goal here...  
> **username_0**: @username_3 Mamp does indeed stand for that. Mamp pro is a bit of software that, among other other things, allows for multiple sites to be run locally with custom URLs. I am seeking a way to replicate that: IE run all my sites on docker with those custom local URLs  
> **username_0**: I have edited the question to make it more clear  
> **username_3**: Use traefik to route them, moving to docker change the paradigm, you'll probably need an orchestration layer like k8s (look for minikube for a dev station) or swarm to tell traefik about the containers running so it can self configure to route to them by hostname  
> **username_3**: BTW my remark about mamp is that you're asking in the title for php apache Mac Apache Mysql Php (it's redundant and badly worded, it has been better to drop a word about what mamp is than dropping words   side by side)  
> **username_0**: @username_3 I notice that you are suggesting a third party tool, is there a reason for that? Is there a reason that I cannot do this with apache docker containers?  
> **username_3**: You can reinvent the wheel as much as you wish, something will have to ask docker daemon for containers and then write apache vhost configuration to proxy to containers, that's a lot of work and a bunch of people are already doing it in an open source way, I see no reasons to not use it.  
> **username_0**: (btw if you put this into an answer with detail I will accept it) Fascinating, I wonder why something that seems so basic isn't already baked in  

---

## 0 answers

