Ever wanted to host your own website? Have a spare PC laying around (even REALLY old) that you can use? This tutorial is going to show you how!
Now, three disclaimers I am going to give:
For this, we will be using the Nginx webserver. There are multiple webservers available, but the two most common are Apache and Nginx. My production servers all use Nginx, and without drowning you with information about why, I’ll summarize it as, “Better performance.”
This tutorial will assume you are running Debian, Ubuntu, or one of their derivatives; as they are the most common distributions, and Debian is one of the most popular server operating systems anyway due to it’s rock solid stability.
Note: The first thing we want to do is ensure that our system has the latest updates:
If you have any updates to do, agree to them and let it happen.
Next, we want to install nginx:
Nginx should only take a few moments to install, it’s very small. Once that is done, you’ll want to make sure that nginx is running:
OR if not using systemd:
You should receive some text, telling you something like:
A good way to test nginx and reconfirm that it’s running, is to visit the test page! (That’s right, from the moment nginx installed itself, you have been broadcasting a test page to the internet!)
First, we need to find out what our IP address is. If you are connected to the internet via ethernet, you can try this command:
Or, you can use a command called curl, used to transfer URL data, to check on a website called http://icanhazip.com:
Now that we have our IP address, enter it into your webbrowser using a different device than the machine you are running nginx on:
You should find the default nginx welcome page!
The last part of this very simple tutorial, is knowing the important nginx directories.
This is the absolute barebones basic of nginx hosting.
Having nginx installed and running is fine and dandy, but we need a domain name!
Freenom is an amazing little website offering year long subscriptions without the need for registration, to free domain names, such as myfreetestsite.tk or Miketurcotteisawesome.tk
Feel free to register a domain name to use for your website! You will need a basic understand of how to point your domain name to your sever using DNS. I found a handy little website specifically using freenom, showing how to do that in about 30 seconds.
Once that is done, people can then enter http://yournamehere.tk (or whatever your domain name is) and visit your website.
What are your thoughts? Ever had the desire to put something up on the internet? Would tutorials like this be of interest? Give me some feedback in the comments!
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.