Playground Synology [Synology] Connecting a Custom Domain to Photo Station

Overview

This guide explains how to connect a custom domain to Synology Photo Station.

Introduction

After purchasing a personal domain and setting up reverse proxy, I successfully connected subdomains to each application as follows:

  • blog.mydomain.com
  • dsm.mydomain.com
  • drive.mydomain.com

However, connecting a subdomain to Photo Station turned out to be a bit tricky. The methods that had been previously shared online didn’t work – possibly because of a DSM version upgrade or because I was applying them incorrectly. While searching for a solution, I found a relevant Gist and applied it successfully.

I’m sharing this in case anyone else is struggling with the same issue.

Warning: As a prerequisite for this process, a subdomain such as photo.mydomain.com should already be connected to your Synology via CNAME record registration.

Steps

1. Create Photo.mustache

Create a file named Photo.mustache in the /usr/syno/share/nginx directory with the following content. Set server_name to the subdomain you want to connect.

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name photo.mydomain.com;

    location = / {
        {{#DSM.ssl}}
        if ($scheme = https) {
            rewrite / https://$host/photo/ redirect;
        }
        {{/DSM.ssl}}
        rewrite / http://$host/photo/ redirect;
    }

    include /usr/local/etc/nginx/conf.d/www.PhotoStation.conf;
}

2. Modify nginx.mustache

Open the nginx.mustache file in the /usr/syno/share/nginx directory and add the following line:

{{> /usr/syno/share/nginx/Photo}}

Once all the above steps are complete, reboot your Synology and try accessing the subdomain. You should see that it redirects to Photo Station.

References

Leave a comment