Created
December 8, 2020 14:49
-
-
Save lski/75795922aa6d446ae479d4ff623c2b3b to your computer and use it in GitHub Desktop.
Changes the port in nginx in the file. Only for simple replacements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PORT=${1:-80} | |
FILE=${2:-/etc/nginx/conf.d/default.conf} | |
# Replace the port number, retaining whitespace | |
sed -i 's|\([\s]*listen\) *[0-9]*;|\1 '$PORT';|g' "$FILE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment