Created
March 7, 2019 20:02
-
-
Save webNeat/f42b0f979550f4f7233521a2dd3a1565 to your computer and use it in GitHub Desktop.
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 | |
if [ "$#" -ne 2 ]; then | |
echo 'nginx-associate-port-to-domain [port] [domain]' | |
exit 1 | |
fi | |
cat <<EOF > "/etc/nginx/sites-available/$2" | |
server | |
{ | |
listen 80; | |
listen [::]:80; | |
server_name $2; | |
location / | |
{ | |
proxy_pass http://127.0.0.1:$1; | |
include /etc/nginx/proxy_params; | |
} | |
} | |
EOF | |
ln -s "/etc/nginx/sites-available/$2" "/etc/nginx/sites-enabled/$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment