I am actually running a web app in a docker container and I have a simple website for "Under maintenance" in php (but directly in the server, not in a docker container).

I would like to redirect the traffic going to docker to the website "Under maintenance" with some command line but i am a bit lost.

I guess it's about redirecting the port or play with the nginx config file. But if i change the nginx config file, do i need to reboot all the docker containers ?

Can't i just do a redirect with some linux command ? So i could write a script to enable/disable the "Under maintenance" website


If you can, try this: Configure apache2 and host to pass traffic to a docker container with nginx

In this answer, Evhz sets up Apache on the main machine and all other applications in their containers. The containers use another port than 80. Then afterwards he sets up redirecting to that container for some URLs in the Apache config files.

Alternatively, Evhz shows, how you can also use proxy forwarding.

I in fact do also use this solution. But this is just a suggestion, if you're willing to remodel your server stack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.