Last active
November 7, 2017 17:24
-
-
Save drAlberT/74f9d8595c40caab9f86bc9f712fd797 to your computer and use it in GitHub Desktop.
AWS user_data snippets collection
This file contains 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
#!/usr/bin/env bash | |
CONF_DIR="/etc/nginx/sites-enabled" | |
OLD_DEFAULT="default" | |
NEW_DEFAULT="api" | |
# remove old default | |
sed -i'' -e 's/\s*default_server\s*//' "${CONF_DIR}/${OLD_DEFAULT}" | |
# set new default | |
sed -i'' -e 's/\(\s*listen 80\);/\1 default_server;/' "${CONF_DIR}/${NEW_DEFAULT}" | |
service nginx configtest && service nginx reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment