Skip to content

Instantly share code, notes, and snippets.

@drAlberT
Last active November 7, 2017 17:24
Show Gist options
  • Select an option

  • Save drAlberT/74f9d8595c40caab9f86bc9f712fd797 to your computer and use it in GitHub Desktop.

Select an option

Save drAlberT/74f9d8595c40caab9f86bc9f712fd797 to your computer and use it in GitHub Desktop.

Revisions

  1. drAlberT revised this gist Nov 7, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion AWS user_data snippets
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    A collection of snippets to be used as "user data" files in AWS instances creation (but not only)
  2. drAlberT created this gist Nov 7, 2017.
    1 change: 1 addition & 0 deletions AWS user_data snippets
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    A collection of snippets to be used as "user data" files in AWS instances creation (but not only)
    13 changes: 13 additions & 0 deletions nginx_change_default_server.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    #!/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