0

I have a VPS with Ubuntu server, which is running a flask (python) web app, using UWSGI, through reverse proxy with Apache, for the domain "a.com".

Both the flask app & the Apache aren't containerized.

Now I have another web app that I want to deploy to the same server, via a docker container and I'm considering to have a 2nd nginx container to act as a reverse proxy with uvicorn, for the domain "b.com".

Is it possible to have the containerized nginx redirecting the traffic for "a.com" to Apache?

P. S. I'm aware that when nginx container is down both domains won't work, but that's not an issue.

Lopofsky
  • 103
  • 2

1 Answers1

0

Of course - you can. Ignore the fact that this is Apache and Nginx or HAProxy or whatever HTTP service you can think of. They will open a TCP port and wait on that port for incoming HTTP requests.

If you want your customer to reach the HTTP service, there must be at least on port 80 a HTTP service to wait for normal http://website/ requests without a port number in the URL. This HTTP service can forward the requests to any other HTTP service - maybe running on port 81, 82, ... or better 8080, 8081, ... on localhost. This is your reverse proxy. It can handle requests on domain base, ip base or path base to identify the correct backend.

I would create that main HTTP service as a "reverse proxy" only - it only forwards requests to other services. It's unimportant if this is a Apache, Nginx or simple HAProxy. Put all your services on other ports and forward to them via localhost:.

There are a lot of howtos for this kind of situations. It is very normal.

TRW
  • 488
  • 3
  • 16
  • Thank you for the reassurance. In the end I've just ditched Apache and loaded everything on Nginx. – Lopofsky Feb 19 '21 at 15:18
  • This is of course the better solution, because you only need to administrate one service (security issues, log files, etc.) – TRW Feb 23 '21 at 09:07