Setup VPS
What are you waiting for? why log in to your favorite time-wasting game if you just can setup your VPS now? With this step-by-step you can make ur VPS production-ready (nahh it's overclaimed but hopefully). I hope this helps anyone setting up their newly purchased VPS. CMIIW
Update the OS​
sudo apt-get update && sudo apt-get upgrade
Config SSH​
Config User​
In this step, there's couple of things u must do
- Add New User
- Add User to Sudo Group
sudo usermod -aG sudo [USERNAME]
- Add SSH Key to User
ssh-copy-id -i [PUB_KEY_FILE] username@remote_host
Buy Domain​
Nothing specific in here, just buy domain from wherever you like or find the cheapest. Set up DNS Record to point into the VPS IP Address
Install & Configure Docker​
Just follow this docs Install Docker
run docker without sudo
Firewall​
Just in case
# Update the default deny and allow rule
sudo ufw default deny incoming
sudo ufw default allow outgoing
# allow SSH
sudo ufw allow OpenSSH
# Check rules
sudo ufw show added
# Enable firewall ( do not enable if u haven't set up allow ssh)
sudo ufw enable
# Show status
sudo ufw status
Get SSL/TLS Certificate​
I will use Cloudflare free SSL/TLS
in here. after you buy domain, you can use cloudflare to set up DNS Record and to Configure SSL.
- Full setup your domain in
Cloudflare
, you can point to this Full Setup Domain Docs - Create SSL Certificate at
SSL/TLS
>Origin Server
>Origin Certificate
. Then create it and copy the certificate intoPEM
andKEY
file in your VPS
Run your App​
U know how, it's your app not my app
Add a Reverse-proxy​
I'll use NGINX in this case, with the SSL certificate that you copied earlier, u can put it in the NGINX config like in This Config to ensure that any connection only serve is through HTTPS