Skip to content

Instantly share code, notes, and snippets.

@firejune
Forked from Stenudd/free_ports.sh
Created October 31, 2021 12:18
Show Gist options
  • Save firejune/e52596c1a778a1c7366ca42f7d83a65f to your computer and use it in GitHub Desktop.
Save firejune/e52596c1a778a1c7366ca42f7d83a65f to your computer and use it in GitHub Desktop.
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# Save this script in one of your shares and schedule it to run as root at boot
# through Control Panel -> Task Scheduler
# DSM upgrades will reset these changes, which is why we schedule them to happen automatically
# Set the variables below if you want to customise the ports which DSM will listen on instead
# NOTE: These ports are used for some services, e.g. Photo Station
HTTP_PORT=81
HTTPS_PORT=444
sed -i "s/^\( *listen .*\)80/\1$HTTP_PORT/" /usr/syno/share/nginx/*.mustache
sed -i "s/^\( *listen .*\)443/\1$HTTPS_PORT/" /usr/syno/share/nginx/*.mustache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment