Renting a Server¶
Approximate Time: 15 minutes (this guide) + 30 minutes (Configuring Your Server) + 30 minutes (Backing Up Your Server)
Approximate Cost: $7-17/month
Configuring a Hetzner VPS¶
Hetzner is an EU-based hosting provider with a good balance of reliability, a decent admin UI, and prices among the lowest.
This guide will use Hetzner's cloud offerings, allowing you to rent a virtual private server (VPS) for €6-15/month (about $7-17/month at time of writing).
https://www.hetzner.com/cloud/
Choices?
There are a lot of choices to make: registrar, host, operating systems, various third-party services. It can be overwhelming.
To help, our guides typically make a general recommendation that we think is a safe choice for most people as well as a few alternatives to consider.
Our resource guide also provides other reasonable choices you can consider:
The other providers have similar offerings, enough so that this guide would still be mostly applicable.
Create a Hetzner account if you don't already have one.
Then, open your Hetzner Cloud dashboard and navigate to Cloud > Servers, then click Add Server.
Now you will be presented with a handful of options to configure before your server is created.
Warning
Read carefully before proceeding.
Not all options can be modified after creation without deleting the server and starting over.
Server Type¶
Servers are spec'd by:
- number and speed of processors (vCPUs),
- amount of RAM,
- disk space,
- bandwidth.
The most important stats to consider are processor and RAM.
If you aren't sure what you need, the smallest available server (1-2 processors, 1-2GB of RAM) is plenty for a small site with little real traffic. If you'll be running multiple processes or have specific needs like full text search or geospatial support, you might want to go up a size or two.
Note
Additional disk space can be configured later, for now pick based on processor/RAM.
Location¶
This is the physical location of the server, and matters less than you may think. Keep the default selection, or you can pay more for a server closer to you if you want. If you're in the US, transatlantic latency will add 100ms or so each round trip, which is fine for most cases.
Image (Operating System)¶
Pick the latest Debian unless you are familiar with another OS and prefer it. The second part of this guide will assume you picked Debian, but if you're familiar with another OS it should be easy enough to translate the commands to your OS of choice.
SSH Keys¶
Your public SSH key is in the directory ~/.ssh in a file that ends with .pub. By sharing this portion and keeping the private key safe, other servers can trust that you are who you say you are.
Upload this file to Hetzner and make sure it is enabled for the server you're creating.
Volumes¶
If you have a need for a large disk, you can attach a volume of up to 10TB here at an additional cost.
As noted, this can be adjusted later, so if you aren't sure, leave this off for now.
Firewalls¶
You may want to add a firewall here.
A firewall dictates which ports on the server can be accessed by the public (or specific IPs).
When you create a new Hetzner firewall you will see it starts with two incoming rules:
- IPs: Any IPv4/IPv6; Protocol: TCP; Port: 22
- IPs: Any IPv4/IPv6; Protocol: ICMP
If you are hosting a web application you should add these two incoming rules for now:
- IPs: Any IPv4/IPv6; Protocol: TCP; Port: 80
- IPs: Any IPv4/IPv6; Protocol: TCP; Port: 443
These ports allow HTTP and HTTPS. (Even if you plan to be HTTPS-only, you'll need to open both ports.)
You can add/adjust these later if you need more.
Note
This firewall will keep requests from even getting to your server, which can be useful to mitigate attacks. It is also editable from the admin console, making it possible to fix accidental lockouts.
You may also decide to configure a firewall on the server itself, which will be discussed briefly in the next part of this guide.
Backups¶
Hetzner, like most hosts, can provide automated backups of your server for a cost. Hetzner charges 20% of the server price for these backups, which is a bit expensive compared to other options.
While this can be convenient, it is a good idea to have more granular backups of things like your database, which will be discussed in the next part of the guide.
The custom backups will be more useful and significantly cheaper, but if you want a bit more peace of mind, you can enable automatic backups now, or decide to add this later.
Name & Create¶
Finally, give your server a meaningful name.
Then press the button to create your server.
After a minute or so, you should have an IP address that you can use to connect to your server with SSH:
ssh root@YOUR-IP-HERE
Next, be sure to proceed to Configuring Your Application Server