33 lines
815 B
Bash
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
|
|
|