Created
April 29, 2022 13:00
-
-
Save BitesizedLion/86d3f0f7ba529ced2e895eb196dc86a6 to your computer and use it in GitHub Desktop.
Add another Reverse Proxy to the NGINX Container
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
| #!/usr/bin/env bash | |
| # ----------------------------------------------------------------------------- | |
| # Name : add-reverse | |
| # Purpose : Add another Reverse Proxy to the NGINX Container | |
| # ----------------------------------------------------------------------------- | |
| if [[ $# -eq 0 ]]; then | |
| printf "Usage: %s {domain name} {ip:port} {https:boolean}\n" "$(basename "$0")" >&2 | |
| exit 1 | |
| fi | |
| if [[ $# -eq 1 ]]; then | |
| printf "Usage: %s {domain name} {ip:port} {https:boolean}\n" "$(basename "$0")" >&2 | |
| exit 1 | |
| fi | |
| if [[ $# -eq 2 ]]; then | |
| printf "Usage: %s {domain name} {ip:port} {https:boolean}\n" "$(basename "$0")" >&2 | |
| exit 1 | |
| fi | |
| clear='\033[0m' | |
| header() { | |
| cyan='\033[0;36m' | |
| printf "\n%b$1%b\n" "$cyan" "$clear" | |
| } | |
| domain="$1" | |
| ip_port="$2" | |
| https="$3" | |
| cd /var/lib/docker/volumes/288a6b1fd3f7a0a434c5cf2ed0f2f4baa902459f821642f6fa4fc13b245634cd/_data/conf.d/ | |
| if [ $https = true ]; then | |
| #printf "yes" | |
| cp gunslinger.nl.conf $1.conf | |
| else | |
| #printf "no" | |
| cp iamrich.nl.conf $1.conf | |
| fi | |
| sed -i -e "s/iamrich.nl/"$1"/g" $1.conf | |
| sed -i -e "s/69.69.69.69:80/"$2"/g" $1.conf | |
| docker exec -it reverse-test nginx -s reload | |
| header 'Config has successfuly been made, and NGINX reloaded!' | |
| printf "Domain: $1\nTarget: $2\nHTTPS: $3\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment