Run nginx in a Docker container on a Synology

In this walk through we will perform the following:

Note: The actual nginx configuration will not be covered here.

  1. Deploy the nginx Docker container (vr-ngx-01)
  2. Mount the following folders and file:
    1. /etc/nginx/conf.d/
      1. it’s assumed your sites .conf file is in this director
    2. /etc/nginx/certs/
      1. it’s assumed your SSL certs live here and are properly referenced in your /etc/nginx/conf.d/your.site.conf
    3. /etc/nginx/nginx.conf
      1. it’s assumed SSL is configured and includes conf.d/*.conf
  3. Link vr-ngx-01 to the Home-Assistant container (vr-hass-01)
  4. Fire up the container and verify connectivity over a secured connection
  5. Remove local port mapping for vr-hass-01

1. Deploy the container

2. Mount the local folders & file

3. Link vr-ngx-01 to vr-hass-01

4. Verify site loads

Browse to https://YOUR-SYNOLOGY-NAME:4443

Note: to make this appear at https://www.virtualrick.com you can configure your router/firewall for port forwarding. Example: external TCP 443 forwards to internal TCP 4443.

5. Remove local port mapping for vr-hass-01

Now that the nginx container is linked to the home-assistant container, there is no need for the home-assistant service port (8123) to be available directly.

Make sure the home-assistant container is turned off, then edit the container and remove the local port configuration.

4 Replies to “Run nginx in a Docker container on a Synology”

    1. Julian,

      Thanks for pointing that out. I haven’t discovered the WebStation package yet, but will check it out!

      1. Stegano,

        I do not believe I fully understand your question. Can you provide a little bit more detail?
        For example:
        what is the external port you’d like to use?
        What is the port you would like to use on your Synology (the NGINX box)?
        What is the port your container application is listening on? (I’m assuming this is in a Docker container)

        Which of these would you like to change?

        In my example here my external port is 443, the NGINX container is listening on 4443, and the container application port is 8123
        To make this work your router would need to translate the request from 443 to 4443.

        Does this help?

Leave a Reply

Your email address will not be published. Required fields are marked *