3

This question is about managing/administering the software of a server in a business environment, so I hope it is not off-topic.

We plan to migrate some of our websites to Docker running on our Synology NAS. However, sites running in Docker have port numbers like 32153. We need to be able to map a specific domain to a specific port but have that appear as if the site is actually running on port 80 for HTTP and 443 for HTTPS.

For example, site1 may be running in docker under port 32100 and is accessible via http://10.0.0.1:32100. However, we want it to be accessible via http(s)://www.mysite1.com:80(:443).

Lastly, if possible, I'd like each of these sites to share the same IP address.

I considered configuring a reverse proxy, such as the IIS Rewrite module on Windows, but prefer a native system method if possible.

How would we enable this type of mapping in Synology or via standard Unix features?

If you

Swisher Sweet
  • 609
  • 2
  • 8
  • 19

2 Answers2

3

As it turns out, Synology has a built-in Reverse Proxy feature, which will allow one to map hosts and ports as I described in my question:

enter image description here

I'm sure there's a way to do all of this using the Unix CLI, but this solves my problem.

Swisher Sweet
  • 609
  • 2
  • 8
  • 19
  • 1
    It'll solve your problem at least until the Docker container restarts, at which point it'll get a new ephemeral port... – womble Oct 06 '18 at 00:50
  • @womble thanks for the tip. It appears one can use the `-p` param when starting the Docker image to solve this. Also, there is an option to specific a static port in the Docker software on Synology. – Swisher Sweet Oct 09 '18 at 12:50
2

Docker instances of nginx/apache run internally on port 80/443 but can be mapped to random port numbers on the host. Or you can map them to port 80/443. See the documentation: https://docs.docker.com/config/containers/container-networking/#published-ports

Also please share your configuration if you can't get something to work.

Tommiie
  • 5,547
  • 2
  • 11
  • 45