Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vincent15000's avatar

Application in production on several mirror servers and with different IP addresses

Hello,

A quick explanation ...

I won't install the application in production, it's someone else who will do that. I just have to setup docker so that there will be a docker image to retrieve and to be run on the production server.

So I don't know each detail for the moment.

The boss gave me these informations.

The Laravel application will be running on different mirror servers with different IP addresses. If one server fails, another will replace the first, so that the service is not discontinued.

Furthermore in the society there are several networks and each network has to access to the application.

He told me that it would be interesting to have a dynamic APP_URL in the environment file. But I think that it's not possibile. Or perhaps any way to do that I don't know ? Or perhaps a way to dynamically create the .env file via docker with the IP address of the server ? Or some other way ?

Or setting the APP_URL to 0.0.0.0 ?

I think that he wants to do like this so that there will be no configuration to do on the servers. Just retrieve the docker image and execute it.

But is it possible ?

According to me it's a network configuration problem and not a Laravel problem.

What would you suggest me ?

Thanks for your help.

V

0 likes
2 replies
martinbean's avatar
Level 80

@vincent15000 What has the server IP address got to do with the application URL? Surely the application is going to have the same URL, no matter what “mirror” is used to serve the request?

It sounds like your boss just wants a load balancer and multiple nodes for redundancy, in case one node fails. Just bear in mind this is going to affect things like sessions and cookies if you use the file driver. As if a session is created on Node A, but then Node B picks up the next request, the session file isn’t going to exist on that node and then the user will be logged out, but logged in again if Node A handles a subsequent request.

2 likes
vincent15000's avatar

@martinbean Yes we have discussed this.

I really don't know anything about all this.

I don't think that he needs a load balancer, he explained me that he just want a 2nd server, perhaps a third one, ready to accept the requests only if the first server is down. As long as the server A is up, servers B, C, D, ... won't be used. That's what I have understood.

Please or to participate in this conversation.