Hello everyone, how can I use two different php versions, in two virtual hosts, with the same installation of devilbox?
Thank you all
The way I do it is by installing two instances of devilbox. Of course, you need to set up each one to listen on a different port on your host. I’m doing exactly that in a VPS, but I guess you can do it too in your own computer.
Thanks PaulJbis for the answer.
How can I set the two different IP, what values can I assign to LOCAL_LISTEN_ADDR?
this is the error message, when I run the “docker-compose up” command, in the new “7.4” directory where I download the other devilbox
Creating network “74_app_net” with driver “bridge”
ERROR: Pool overlaps with other one on this address space
If you have several IP addresses assigned in your host computer, you can use that. But I was talking about assigning ports, that is, the HOST_PORT_HTTPD and HOST_PORT_HTTPD_SSL values.
The way I do it, I assign port 8000 in one of the devilbox instances, and port 8400 (for example) in the other. So I access each virtual host like this:
http://(virtualhost name):8000
http://(virtualhost name):8400
I would like two instances of devilbox, each with its own virtual hosts, but when I try to install the second instance of virtual box it gives me the error:
devilbox creating network with driver “bridge” error: pool overlaps with other one on this address space
Oh, yes, sorry. This is going to be slightly more complicated
When devilbox starts, it creates an intranet in the 172.16.238.x range, and all its containers get assigned IPs in that range. Of course, if you try to start a second instance, it will try to create an intranet in that same range… which is already used.
So the way I did it was… I edited the docker-compose.yml
file in the second instance and changed the IP range specified in it to another one. For example, where it says:
dns:
- 172.16.238.100
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
networks:
app_net:
ipv4_address: 172.16.238.10
I changed all instances of “172.16.238.x” to “172.16.220.x”, so that this second instance uses that IP range. You’d have to change that value everywhere there’s a mention to that IP range.
Note that the docker-compose.yml
instructions tell you not to edit that file, but to use a docker-compose-override.yml
instead. But since this is a change that affects every service, and since I’m not a Docker expert (and don’t know exactly how the override file interacts with the main one), I found it simpler to just edit that file. If you do that, make a backup of the original first and be careful to change only the IP ranges.
Again, sorry for not mentioning this at first. I had completely forgotten about this.
I have compiled the file “docker-compose.override.yml” change the IP as @PaulJBis indicated.
The second devilbox daemon has been compiled, but when I connect to the defultlocalhost, the connection is broken.
the log file returns the following error:
[Fri Apr 10 16:14:19.374710 2020] [proxy_fcgi:error] [pid 480:tid 140712599324416] [client 172.16.210.1:33614] AH01079: failed to make connection to backend: 172.16.238.10
where 172.16.210.1 is the IP address modified by me, while 172.16.238.10 is the one previously indicated
Did you edit the docker-compose.yml or just added a docker-compose.override.yml file? Remember that all the containers (web server, PHP and MySQL) need to be on the same subnet.
To confirm that this is the case, please do a “docker inspect” for each of the containers and see which IP address they have.
@PaulJBis I solved, only one parameter was missing in the “docker-compose.override.yml” file “PHP_FPM_SERVER_ADDR=”.
Now i have this error message in the default page and in the list of virtual hosts:
random.test
Failed to connect to Httpd host on random.test
@AndreaPGITA you can as of now: 🎅🎄🎁 by cytopia · Pull Request #942 · cytopia/devilbox · GitHub