Skip to content

Instantly share code, notes, and snippets.

@Stenudd
Forked from hjbotha/free_ports.sh
Created March 13, 2019 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Stenudd/434195a35699bc165890a12d3f12dbfd to your computer and use it in GitHub Desktop.
Save Stenudd/434195a35699bc165890a12d3f12dbfd 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