I’m looking to host multiple services on a single compute instance. I’m using docker for the one existing service, which has been configured to serve the http on the usual ports. And since I’m using docker I figured it would be easier to set a routing setting than set up a new apache/nginx server.
Could I route the traffic from one address to a specific port? Or, more specifically, is it possible to map a specific port on the server to the http/s ports for a certain domain name?
If it is possible I’m sure it must be a simple setting, but I’m not intimately familiar with GCloud so I’m also sure that I’m missing something.
2
Answers
Yes, you can route ports using IP Tables or setting up a container for virtual hosts which will use Apache or Nginx or similar). However, there are very good reasons to not expose Docker containers to the Internet. Deploy Apache or Nginx as your frontend or deploy a Google Cloud HTTP(S) Load Balancer.
This is not how virtual host works – only cannot simply remap
:443
without breaking SSL.Use Cloud DNS to provide name resolution & use virtual host to tell apart the host headers.
External HTTP(S) Load Balancing would be required to map different internal ports
which also requires named virtual hosts – else the backend will not know which site it is.
With named virtual hosts one can also define multiple SSL certificates.