clippable/aws/infra/scripts/server-setup.sh
shockrah a5f649a284 + ebs section for terraform build
+ Basic nginx setup script
certbot commands are not included
2021-10-21 23:55:58 -07:00

33 lines
815 B
Bash

#!/bin/sh
# This script runs in order to to set things up for so that we don't have to do
# much else by ourselves
# No harm in using sudo even as root its just a little pointless
# Doing this with our ami however means we don't have to check if we're root
# for privileged operations at provision-time
apt="sudo apt"
server_name=$1
if [ -z "$server_name" ];then
echo A servername must be given as an argument
fi
$apt update
$apt upgrade
$apt install -y nginx certbot
sudo mkdir -p /var/www/clippable
# Creating the reverse proxy configuration for nginx
# WARN: Also we're assuming that the webserver has the default port
# Only this because certbot does the rest
cat << EOF > /etc/nginx/sites-available/clippable
server {
server_name $server_name;
location / {
proxy_pass http://0.0.0.0:8482;
};
}
EOF