Should you run your own web server?

Running your own web server at home can be a very fun project, and you won’t have to worry about hosting fees. This guide will teach you how to run your own web server and also how to get a free domain name.

Before we continue, here are some things which you should know:

  • You will need to forward ports on your router, which could be dangerous if you don’t have a proper firewall
  • Your connection speeds will be a bit slow (avoid images and files over 100kB)
  • You may be violating your Internet Service Provider’s Terms and Conditions. However, you should be fine if your website doesn’t generate too much traffic.
  • You will need to pay electricity fees, so a low-power device such as a Raspberry Pi or an old computer will be perfect.

Raspberry Pi

Building a website

Before you start trying to host your own website, you need to have a website to host!

I recommend that you build a static website using Jekyll and test it using both localhost and Github Pages.


Since there are already many high-quality tutorials on this, I am not going to cover it here. Please follow this guide!

If you want, you can view this site’s code as an example (it is built with Jekyll).

Apache server

To host your website, you will first need to install Apache server. Here are the official instructions.

After installing Apache server, copy everything from your Jekyll “_site” folder to your Apache root directory. Then open a web browser and type “http://localhost” in the address bar. Your website should show up.

FREE domain name

To register for a free domain name, just go to and pick a domain that ends with .tk, .ml, .ga, .cf, or .gq.

Managing DNS

Now that you have a local website on your computer and your own domain name, you need to link your domain name to your computer. NOTE: This guide only covers IPv4 because I know nothing about IPv6, but there is a 99% chance you are using IPv4.

First, sign in to Freenom and go to Services -> My Domains. Then click Manage Domain. Go to the Manage Freenom DNS tab and add a record. You must leave the “name” blank. You can use A for “type” and 3600 for TTL. For “target”, enter your (external IP address)[].


Now, open a command line and enter ping (your website name without brackets). Your external IP address should show up. If it doesn’t, then wait a few hours before trying again because it might take up to 24 hours for the DNS records to update. You most likely do not have a static external IP address, so you will need to update your target whenever it changes.

Port forwarding

After setting up a DNS, people will know your computer’s external IP address (which all of the computers in your home share), but you need to set up port forwarding in order to direct your website traffic past your router’s firewall to your computer.

First, go into your router settings. Find your router’s internal IP by typing ipconfig into a command line. Your router’s IP should be the “Default Gateway” in the information which shows up. Most routers have an IP address of or or, but this is not always the case.

Once you have found your router’s IP address, open a web browser and enter it in the address bar. A form should show up asking for your router’s admin password. If you have not changed your router’s admin password (not to be confused with WiFi password), you can find your router’s default password here.

In your router settings, first go to DHCP settings. Find your computer in the DHCP reservations section and use the “Reserve” option (there should be a similar option on all routers), which gives your computer a static internal IP address within your home. Your external IP address identifies your home on the entire Internet, and your internal IP address (which only computers in your home an see) identifies your computer in your home. Pick a static internal IP address for your computer within the DHCP range.


Next, you will need to forward port 80 (the HTTP port). Go to Port Forwarding settings. Click something similar to “Add” or “Create a new rule”. Use whatever you want for “name”, both for protocol, 80 for “internal port”, 80 for “external port”, and your computer’s internal static IP addresss for “IP address”. There may not be an “internal port” and “external port” option, but only a “port” option. In that case, just enter 80 for “port”.

Save your settings, and your website should work!

Testing your website

Open a browser and put your website domain name into the address bar. You should be led to your website.

If it doesn’t work, it may be because your router does not support hairpinning, meaning that devices within your home network can only access your website through your computer’s internal IP address, not through its domain name. Try using a different connection such as Public WiFi to access your website. Also make sure that your router is connected directly to your modem (not to another router), and you do not have a double NAT issue. NOTE: you may have a modem/router combo like the Bell Home Hub 3000. If you do, your computer should be connected directly to the modem/router combo, and you should use the modem/router combo’s settings to set up port forwarding.


Assuming that your website now works, it is time to set up HTTPS. Without HTTPS, your website uses HTTP, and you get an ugly “Not Secure” warning when you visit your website. Setting up HTTPS is extremely easy.


Assuming you are using some sort of Unix operating system like Ubuntu (too bad if you aren’t!), go to Follow the instructions on how to use Certbot to set up HTTPS.

After you have set up HTTPS on your computer, forward port 443 on your router (the HTTPS port) the same way you forwarded port 80.


If you have read all the way up to this sentence, you definitely have an above-average attention span and it’s time to press CTRL+W!