Skip to content

Instantly share code, notes, and snippets.

@aaronmyatt
Last active May 14, 2018 01:48
Show Gist options
  • Save aaronmyatt/8651f5343fef7d42a7b047a8a27aeb7e to your computer and use it in GitHub Desktop.
Save aaronmyatt/8651f5343fef7d42a7b047a8a27aeb7e to your computer and use it in GitHub Desktop.
apt-get update && apt-get upgrade && apt-get autoremove
apt-get install git nodejs nginx ufw python3 python3-pip curl
pip3 install jinja2-cli
ufw allow 22 && ufw logging off && ufw enable && ufw status
npm install yarn
apt-get install rng-tools # Apparently: https://stackoverflow.com/questions/37501596/random-nonblocking-pool-initialization-taking-a-long-time-on-ubuntu-16-04-ser
# USER
echo "Enter your app name (note: this will double as your default username)"
read APP_NAME
adduser $APP_NAME --disabled-password
echo "Copy in your .pub ssh key so you can ssh in with: ssh `$APP_NAME`@serverip"
read SSH_KEY
mkdir /home/$APP_NAME/.ssh
touch /home/$APP_NAME/.ssh/authorized_keys
echo $SSH_KEY >> /home/$APP_NAME/.ssh/authorized_keys
chown $APP_NAME.$APP_NAME /home/$APP_NAME/.ssh -R
chmod go-rwx /home/$APP_NAME/.ssh -R
# NGINX
rm /etc/nginx/sites-enabled/default
touch /etc/nginx/sites-available/$APP_NAME
touch /tmp/nginx.conf
/tmp/nginx.conf < curl https://gist.githubusercontent.com/aaronmyatt/30f1e0166976a764acac259a8f80ccb7/raw/199ef107daf52f464d19b9edf62efbdee6146f07/generic%2520nginx%2520config
/etc/nginx/sites-available/$APP_NAME <
cat /etc/nginx/sites-available/$APP_NAME
ln -s /etc/nginx/sites-available/$APP_NAME /etc/nginx/sites-enabled/$APP_NAME
nginx -t && service nginx reload
ufw allow 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment