Skip to content

Instantly share code, notes, and snippets.

@kirankotari
Forked from abraunton/provision-lb.sh
Created February 20, 2019 05:16
Show Gist options
  • Save kirankotari/5a55e4d72e7dd7bdbd2200043bf8e8ba to your computer and use it in GitHub Desktop.
Save kirankotari/5a55e4d72e7dd7bdbd2200043bf8e8ba to your computer and use it in GitHub Desktop.
#!/bin/bash
echo 'Starting Provision: lb1'
sudo apt-get update
sudo apt-get install -y nginx
sudo service nginx stop
sudo rm -rf /etc/nginx/sites-enabled/default
sudo touch /etc/nginx/sites-enabled/default
echo "upstream testapp {
server 10.0.0.11;
server 10.0.0.12;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
location / {
proxy_pass http://testapp;
}
}" >> /etc/nginx/sites-enabled/default
sudo service nginx start
echo "Machine: lb1" >> /usr/share/nginx/html/index.html
echo 'Provision lb1 complete'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment