I have a Synology NAS with WAN access using an Nginx reverse proxy. Since the subdomain cloud.domain.com
is routed to the Synology, all subfolder pathing is managed by the Synology application.
screenshot of Synology interface where /files
is assigned
To access the File Manager, I'd use the following URL:
https://cloud.example.org/files
I have a shared folder in File Manager which uses a tinyURL style link for direct access. I'd like to build a redirect that would point directly this shared folder with a custom URL, such as the following:
https://cloud.example.org/public_downloads
In other words, I need to use https://cloud.example.org/public_downloads
to access https://tiny.url/abcd123
. Is there a way to override a specific subfolder path without breaking the Synology-managed ones like /files
?
I've reviewed a similar question nginx Redirect specific subdomain and path but after looking at the linked documentation, I'm not seeing how I can configure it for the /
pathing rather than the subdomain. I suspect the key lies in manipulating the location
section of the Nginx config for my cloud.example.org
server.
My Nginx config for the Synology
## CLOUD HTTPS ##
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name cloud.domain.com;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_certificate /usr/share/nginx/ssl/example.org-chain.pem;
ssl_certificate_key /usr/share/nginx/ssl/example.org-key.pem;
ssl_session_cache shared:SSL:10m;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=2592000; includeSubdomains" always;
add_header X-Frame-Options "SAMEORIGIN" always;
proxy_hide_header X-Powered-By;
add_header 'Referrer-Policy' 'no-referrer';
add_header Content-Security-Policy "frame-ancestors example.org app.example.org;";
location / {
proxy_pass http://10.1.2.3:5000;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_redirect http://synologyhostname:5000 https://$host/:5001;
}
}
## END CLOUD HTTPS ##