Install Nextcloud With SSL on Synology via Docker

  1. Buy a domain and point it to your server.
    1. For Dynamic DNS, Synology offers many options including Google Domains. All options can be found in Control Panel > External Access > DDNS
    2. If you need to run a custom DynDNS option, you can use to build in Task Scheduler to automatically update any custom service via PHP. This can run every hour.
      1. To do this, you need to code your script in PHP and then in DSM, go to Control Panel > Task Scheduler > and set up your script. In Task Settings > User-defined script, enter it as:
      2. php {script_full_path}.php
  2. Use your router to forward ports 80 and 443 to your DSM’s IP. You can remove port 80 at the very end.
  3. If you haven’t already, install Docker from Package Center
  4. In Docker, in the Registry Tab, search for Nextcloud and install it. It should be named “Nextcloud” not Something/Nextcloud.
  5. Go To Docker’s Image tab and select and launch Nextcloud
  6. Name your container and jump into “Advanced Settings”.
    1. You’ll probably want to enable auto-restart
    2. Set your ports up under Port Settings. You should pick static port numbers, like
      1. Local Port: 8080 = Container Port: 80
      2. Local Port: 4433= Container Port: 443
    3. I would strongly recommend setting Volumes for your data, config and apps as described here.
    4. I’ll leave the database up to you, but I use a separate docker container with MariaDB.
    5. Now you need an SSL cert. To Use Let’s Encrypt, go to Control Panel > Security > Certificate and Add a new certificate.
    6. Next we’ll head over to Control Panel > Application Portal > Reverse Proxy and add a new rule
      1. Source:
        1. Protocol: HTTPS
        2. Hostname: your domain
        3. Port: 443
      2. Destination:
        1. Protocol: HTTP
        2. Hostname: DSM local IP address
        3. Port: Nextcloud container local port that redirects to the container port 443 (In this example, we’d use 4433)
    7. Save this and head back to Control Panel > Security > and click the Configure Button
      1. Find the “Services” with your domain name and set the certificate to that with the same name.
    8. You’re done!

Leave a Reply