Hosting a static site on a VPS (part 1)

Goodbye GitHub Pages, hello Linode!

Posted on 2017-08-01

The big picture

For a while now, I've hosted my static sites on GitHub Pages, which is free and convenient (thanks, GitHub!). However, I always wanted the freedom that a VPS (Virtual Private Server) offers you to do things like hosting your own sites, deploying web applications, etc. It would be a great learning experience, going from installing Debian on it, to setting up a web server, reverse proxy, etc. As such, I rented out my own VPS from Linode, which offers a basic plan with 1GB of RAM for $5/month.

In this three-part tutorial series, I'll show you how I went about getting my VPS, putting my domain name (vincentchov.com) on it, configuring Nginx, and serving up this static site!

Getting a VPS

First, you can choose any cloud provider you'd like for a VPS, like DigitalOcean, but since I used Linode, I'll show you how to go the Linode route. In the end, it doesn't really matter which provider you choose anyway. First, make an account at Linode, making sure to use a coupon code you can find in their documentation section. When asked which operating system you'd like, choose Debian 9.

Getting a domain name

You probably want to use a domain name like www.yoursite.com instead of the IP address that Linode gave you. Personally, I use Namecheap to manage my domain name. It only cost me $10/year so it's very affordable. Once you have a domain name, you'll want to point the domain name to your VPS's IP address.

Pointing the domain name to the VPS

Follow steps 1-4 of Linode's DNS tutorial under the "DNS Set-Up Cheklist" heading. Essentially, you're going to Namecheap to set your domain name's DNS servers to Linode's DNS servers, adding some records, and then on Linode's side, setting up reverse DNS to your Namecheap domain name. It probably won't work right away, because your DNS records haven't had time to propagate. In a couple hours to a day, your DNS records should have propagated, so don't lose sleep over it not working...yet.

Conclusion

Now that you have set up a VPS and your domain name, you're ready to start setting up Nginx, which is great for serving up static files and also working as a reverse proxy that can point to Python-based web apps! Move to the next section of this series to find out how!