
Become an Internet Landlord
Table of Contents
Why?
It’s simple: it’s about your freedom to say whatever you want. Nowadays, everyone is hanging out in someone else’s space (Twitter, Facebook, Instagram, etc.). While these platforms might give you a room to stay in, they can — and will — kick you out if they don’t like what you say or do.
Aside from owning your own piece of the internet — which in itself is a good enough reason to start right away — It also shows professionalism to your colleagues, team, and future employers.
If you work in the tech industry then owning your website is not a matter of should but a matter of must. It’s an impressive feat, especially to those who think coding is some sort of black magic.
How?
To create a website you need 3 things:
- A domain
- A server
- And your content
Domain
Let’s start with the domain. A domain is a like your address on the internet. Domains are registered by the Internet Corporation for Assigned Names and Numbers (ICANN). But you don’t have to deal with them directly, instead you can use a domain registrar.
There are countless domain registrars, but here are a few I’ve heard good things about:
I personally used Porkbun and I can say that they are great.
You can get a .com
domain for around 10$ per year.
Many other domain extensions are available for different prices,
but you should look out for the renewal price as some domains are cheap to buy but expensive to renew.
After you buy your domain you get access to the DNS records of your domain we’ll use this after we get our server.
A DNS (Domain Name System) just translates human-readable domain names (like example.com
) into IP addresses (like 192.0.2.1
).
The DNS records will point to the IP address of the server that will host your website.
Server
What is a server?
Servers are computers that do a specific task. In our case we want a server that serves our website to the world.
Getting a server
Theoretically, you could just use an old computer laying around in your house and turn it into a server. However, you shouldn’t do it because:
- You have to open ports on your router to let outside traffic in which can be a security risk.
- You have to supply your server with a power and internet connectivity 24/7.
For these reason, just cough up $5 a month and get a server from a hosting provider.
Here are some hosting providers I have tried:
- Vultr (What I use)
- Get the $3.5 server in US-NY with 1 CPU, 512MB RAM, 10GB SSD, and 0.5TB bandwidth. it’s more than enough for a personal website.
- AWS
- AWS is great if you want to expand and use more services.
- A t4g.micro will run you around $3.07 per month. they cost pile up quickly when you account for bandwidth and storage.
You don’t need a really powerful computer if your just going to serve some html pages.
When setting up your server, you’ll have to choose an operating system. Just choose Debian 12 or 13 — it’s free, widely used, and well-documented.
After you get your server
- When you set up your server, create a network firewall rules and allow traffic on
- TCP connections port 22 for SSH (you’ll use ssh to connect to your server)
- TCP connections port 80 for HTTP
- TCP connections port 443 for HTTPS
- Change the reverse DNS to point to your domain name.
After you get your server you have to edit the DNS records of your domain to point to your server. Go to your domain registrar’s website and find the DNS management page.
Add the following DNS records:
-
A record: Host:
"www"
, Value:IPv4 of your server
-
A record: Host:
"*"
Value:IPv4 of your server
-
A record: Host:
""
Value:IPv4 of your server
-
AAAA record: Host:
"www"
, Value:IPv6 of your server
-
AAAA record: Host:
"*"
, Value:IPv6 of your server
-
AAAA record: Host:
""
, Value:IPv6 of your server
These records might take some time to propagate (reach DNS servers around the world).
Setting up a simple HTTP website
you need to connect to your server using SSH
use the following command to connect to your server:
Assuming you added the records in DNS management page and your domain is example.com
.
ssh -p 22 root@example.com
You’ll then be prompted to enter the password of your server, you can find it in the dashboard of your hosting provider.
After you log in to your server you should do the following:
- Update your server
apt update && apt upgrade -y
- Install
nginx
web server,certbot
for SSL certificates, andufw
firewall
apt install nginx certbot python3-certbot-nginx ufw -y
- Allow traffic on ports 22, 80, and 443 using
ufw
ufw allow 22
ufw allow "Nginx Full"
ufw reload
systemctl enable ufw
- Create a new
nginx
configuration file for your website sayexample.com
and create website directory
touch /etc/nginx/sites-available/example.com
mkdir -p /var/www/example.com
- Edit the configuration file using
nano
orvim
nano /etc/nginx/sites-available/example.com
put the following content in the file:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/example.com;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
}
- Enable the configuration by creating a symbolic link to
sites-enabled
ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
- Test the
nginx
configuration and reloadnginx
nginx -t
systemctl reload nginx
- Create a simple
index.html
file in your website directory/var/www/example.com
to test if everything is working
echo "<h1>Hello World from example.com</h1>" > /var/www/example.com/index.html
- Open your browser and go to
http://example.com
; you should see the “Hello World from example.com” message.
Setting up HTTPS
Search engines like Google give preference to websites that use HTTPS over HTTP. If you plan to add login or payment functionality later, HTTPS is a must.
Getting certificates used to be a hassle — expensive and time-consuming. But now with certbot
it’s a breeze.
To secure your website with HTTPS you can use certbot
to get a free SSL certificate from Let’s Encrypt.
Run the following command to get and install the SSL certificate:
certbot --nginx
Follow the prompts to enter your email address and agree to the terms of service. Certbot will automatically configure nginx
to use the SSL certificate.
After the process is complete, you can test your website by going to https://example.com
in your browser. You should see a padlock icon indicating that the connection is secure.
Certificates are valid for 90 days but certbot
automatically renews them for you.
Your Content
What you put on your website is entirely up to you. You can create a simple static website using HTML, CSS, and JavaScript. Or you can use a static site generator like Hugo
Simply upload your files to the /var/www/example.com directory, and your website will go live.
Some Tips
- Look for coupons when purchasing your domain or server — you can save a few bucks that way.
- Use Git to manage your website files.
- Create a SSH key pair and use it to connect to your server instead of using a password. (look up how to do that online)