Awesome, you’ve decided you need a website – that means a new project is about to reach the world through the wonders of the Internet! 🦄

On a more practical note, though: how do you keep that website available to the world? The site’s data should be stored somewhere, after all.

That “somewhere” is a specialized computer called a server (because it serves your website’s constituents to your visitors) – so here’s what we’re going to discuss in this guide:

  1. First, in order to find solutions to our website conundrum we will need to understand what exactly a server is and how it works. If you’re familiar with all this, feel free to skip to the next part,..
  2. …where we’ll learn how to configure and run your own web server at home (and discuss why it’s called “the hard way”).
  3. Finally, we will look at a somewhat easier alternative – yes, you guessed it, renting a server – and see how this approach may actually be more cost-efficient than a seemingly “free” home server.

Let’s dive in:

Ingredients of a Web Server

As we’ve already established above, without something to make it available to the world, a website is just a heap of files.

In principle, any computer (including your smartphone) can become a web server – all it needs is to meet a couple of conditions:

  • Stable internet connection, preferably a high-speed link, in order to be able to receive requests from visitors and serve them files 24/7. A website that is only available during the day might have worked for young Ilon Musk in 1995, but it’s a total no-no in 2020.
  • Specialized software that can receive requests from the network and send the website’s files to the user’s computer in the correct way.
  • Sufficient resources, including storage, memory, and processing power, to be able to generate responses really quickly and support several (or a lot) simultaneous sessions.

Alright, the 2nd and the 3rd seem to require more attention, but the first one is piece of cake, right?

Not so fast (pun intended). If you’re using a home-made server, you will need to take into account your home internet connection quality – especially upload speeds.

While the most often-cited parameter for browsing the web, playing online games, and streaming video is the download speed, the reverse is much more important for serving website files to visitors!

This means you’ll need to keep in mind your internet provider’s upload speed – which is much lower than download speed for most types of connections – not to mention the fact that real upload speed during peak hours might differ significantly from the advertised figures.

Let’s take another step back though.

A computer that needs to be online 24/7 needs to be running 24/7 in the first place – which means any automatic updates that restart your machine, power network outages, or even simple clumsy cable accidents all eat into the DIY server’s uptime – even before we consider the internet connection.

***

But let’s assume for the time being that you are using the latest fiber connection at home and never leave your computer unattended. What specialized programs do we need to run a web server?

To host a website built on a popular platform like WordPress, your homemade server will need a couple of crucial programmatic components:

  • The web server itself, a piece of software that coordinates the entire client-server shebang: i.e. something able to receive requests from remote users and send the website’s files to them is the correct manner. The most popular web servers today are Apache and Nginx.
  • A database which will store the website’s data, such as content and settings. By far the most popular free database engine on the web is MySQL, which comes in many flavors, including foremost MariaDB.
  • An interpreter for files written in a scripting language, e.g. PHP or Perl. This usually comes with modules that extend its core functionality and allow other parts of the server to perform various extra tasks, such as speaking with the database or getting remote files.

All of this, and several other minor components, works on top of the server’s operating system – most commonly Linux:

How to host a website - Linux setup

However, manually installing and configuring every server component can be a tremendous pain in the rear – thankfully, we can use a ready-made “packaged stack” to simplify things.

Here’s the gist –

The Hard Way: Running Your Own Server at Home

When it comes to software, there are 4 main free options for those who want to host a website locally; the differences boil down to interface, compatibility, and additional tools:

  • WAMP, which was created mostly for the Windows operating system, as its first letter suggests;
  • MAMP, a package geared towards MacOS users which also has a rudimental Windows version;
  • LAMP, the classical Linux stack for server deployment which stands for “Linux, Apache, MySQL, and PHP”;
  • XAMPP, a user-friendly, cross-platform solution that is available for all major operating systems.

Thanks to its versatility as well as a slew of free pre-built modules for running popular content management systems (CMS) like WordPress, the XAMPP is arguably the best option for setting up a web server in domestic conditions.

Remember the essential server components we described earlier? With XAMPP, they are all neatly tucked into a single package and set up (almost) automatically during the installation. The end result looks something like this:

How to host a site - XAMPP

Before we look at the specific steps though, here is a piece of information you should definitely see before trying them in practice:

***

IMPORTANT! In order for your home-hosted website to be available using a domain name (like https://yourdomain.com) you need to make sure that your internet service provider can provide you with a static IP address.

With a dynamic external IP we lose the entire point of hosting from home because you will have to adjust your domain name’s configuration each time your provider gives you a new IP (which may be every time you connect to the web).

While a few home internet packages include static IPs by default, they might be available as a separate paid add-on or as a part of a small business package.

***

Alright, assuming we do have a static IP available let’s roll up our sleeves and put that website online:

You can download the appropriate version of XAMPP from their official homepage; here’s a step-by-step guide to get you started:

  1. The installation process itself is quite straightforward, you can simply click “Next” or “OK” on all prompts. Click on “Allow access” when the system asks you to give new network permissions – this bit is needed for the proper functioning of the local server.
  2. Once XAMPP is installed, you can open the control panel and start the Apache and MySQL services; the respective statuses should turn green, and you should see a test page if you go to http://localhost in your browser.

    XAMPP application
  3. As we mentioned earlier, using a ready-made module for your favorite CMS (e.g. WordPress or Joomla) will save you a lot of time compared to manual setup, so for this tutorial let’s download the WP module from Bitnami’s official repository.
  4. When the download finishes, click on the module installer and follow the prompts; be sure to un-tick the “Deploy in the cloud” checkbox – it’s a paid feature, and the entire purpose of our current quest is to achieve a local setup!
  5. When it’s done, launch the application and it should open a crispy new WordPress website which is now accessible at http://localhost/wordpress.
  6. Boom! You now have a fully functioning WordPress site on your local machine. The files will live in the C:\xampp\apps\wordpress\htdocs folder (this may change depending on where you installed XAMPP).
  7. If we want our new website to be accessible from any other computer on the web, we will need to do two more things. First, you will need to buy a domain name – the best choice is available via larger providers such as GoDaddy or Namecheap.
  8. Second, we will need to link that domain to your local website. For starters, go to C:\xampp\apache\conf\extra on your computer and open the https-vhosts.conf file with a notepad or any other plain-text editor. Paste the following lines at the bottom of the file:

    <VirtualHost *:80>
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
    DocumentRoot "C:\xampp\apps\wordpress\htdocs"
    <‌/VirtualHost>
    

    Replace the bold parts with your real data wherever needed. Save and close the file.

  9. We will also need to adjust the operating system’s host file; you will find it in the following folder – C:\WINDOWS\system32\drivers\etc (or /private/etc/hosts if you’re on an Apple machine). Open the file and add this line at the bottom:

    127.0.0.1 yourdomain.com
  10. Next, if you are using a home router you will need to assign a static IP to your computer in the router’s settings. The procedure depends on your router model, so please consult with its manual for the exact set of steps (hint: look for the “DHCP” keyword).
  11. While we’re at it, add a routing rule to direct your external (fixed) IP traffic to your device’s static IP in your router’s admin panel. Again, very much depends on your router brand and model.
  12. Our website is now exposed to the internet through an IP address. All that’s left to do is to point your domain’s A-record to this IP in the DNS settings. Again, this will vary greatly depending on the domain vendor – consult their documentation or support for specifics.
  13. Note that DNS settings might need a couple of hours to propagate around the web. To check if everything works, visit yourdomain.com in your browser, preferably outside of your home network (e.g. using 4G data on your mobile).

Aand we’re done! Piece of cake 🍰

Now that we are familiar with the basic setup, let’s look at two crucial things you should take into account before deciding to host a website from home:

Things You Should Know When Running a Home Server

If you’re thinking about sticking with the DIY setup, the two most important considerations at this point are security and costs.

Any owner of a home server set up using XAMPP (or any other ‘AMP for that matter) should be aware that the default level of security that comes with a fresh install is meant strictly for local activities – in other words,

For a website exposed to the Internet, security in a default XAMPP setup is almost non-existent.

Here are just some of the things that are meant to make local development easier but instantly create glaring security holes if left untreated in a public website:

  • The default MySQL database administrator account (aka the root user) has no password, in other words free access to anyone.
  • ProFTPD, the bundled file transfer service, uses a known username-password combination (“lampp” for user “daemon”).
  • The default users of other included software such as Mercury and FileZilla services are also no secret.

This means that you will need to customize all of the above if you want your website to have at least minimal attack resistance (if using a well-known default password could even be considered an attack at all…)

Fortunately, most guides are available in your XAMPP dashboard’s How-To section using this link: http://localhost/dashboard/howto.html.

***

Why did we mention costs, though – isn’t our home-made server supposed to be free by definition?!

Well, as Captain famously remarked,

How to host a website - electricity

Using this energy use calculator, you can approximate the additional cost of power that will be consumed by your home server.

For a modest 60-Watt computer and an average US $0.13/kWh electricity price point, you’ll be paying $5-$6 per month for your home server’s juice.

Expect to pay around 50% more in states like New York and 200% more in places like Hawaii; if you live in the European Union, your server’s energy costs will be closer to 6-9 EUR per month.

Pros and Cons of “Home Hosting”

Before we discuss the alternative, let’s summarize the advantages and disadvantages of creating your own server at home:

  • Useful experience: in the process of setting up your own server you can gain a much deeper understanding of how the world wide web works, under the hood.
  • Full control: you can fine-tune every nook and cranny of your custom setup (also called a stack) to suit your requirements.
  • Electricity costs: as mentioned above, your home server will consume $5 to $10 per worth of electricity, and that’s if you’re lucky to live in a place with a low per-kWh price.
  • Static IP required: your internet hosting provider will need to be able to give you a fixed IP address (usually at an additional charge) in order for your domain name to be stable.
  • Low security: since XAMPP is mainly meant for local development, its security is nowhere near the level that is sufficient for a system that is exposed to the outside world.
  • Manual maintenance: you will need to configure and manage the home server by yourself, which includes regular updates, security control, and uptime monitoring.
  • Lower speeds: as we mentioned earlier, most home internet providers offer much lower upload speeds than those available at specialized data centers, which means higher latency for your website’s visitors.
  • Stability issues: automatic updates, power outages, and other inconveniences all threaten to put your site offline at any moment.
  • Resource requirements: unless you own a really powerful machine, even a couple of simultaneous visitors can visibly slow down or crash your website. Low RAM can also interfere with browsing or gaming on the same computer.

As you can see, running your own home server seems to be an uphill battle – and the costs are not as low as one would imagine (i.e. far from “free”).

But there’s a second way, of course – the one you’ve probably discarded as impractical before learning about all the pitfalls of locally hosted websites:

The Easy Way: Using an Existing, Managed Server

Suppose you need a place to live. One option is to gather the necessary tools and materials, learn the technical skills and build your own house by hand …or you can always buy a ready-made house or just rent one (which most people do in real life).

Well, web hosting is a bit like that, at least in terms of the hassle involved.

One of the primary reasons why people consider running their own server is the supposition that it’s free of charge, or at least much more affordable than using a web hosting provider.

Is this intuition true? What are the real costs of a home server?

Knowing what we already know about the requirements and the setup, let’s run the numbers:

  • Electricity bill for a computer running 24/7 will amount to circa $5-$8 per month, depending on your location and the machine’s configuration.
  • Domain name will still need to be purchased for an additional $1-$2 per month (the price of a typical .com domain is around $10 per year, and new domain extensions like .tech or .yoga cost more).
  • Static IP from your home internet provider will either need to be purchased as an extra or as a part of a (typically more expensive) business package, which can cost anywhere between $5-$15 more than your default package.

Taking even the lower estimates for each of the above expenses, we arrive at a total cost of at least $11 per month for a full-fledged home server.

More realistic estimates go as high as $25 per month, which can buy you not only a very decent cloud/VPS solution but even a low-end dedicated server!

Compared to $11/month, value hosting like Warpgate ($3/month, first month free) or even Hostinger (from $8/month, first period $0.80) doesn’t look expensive anymore 🤷

To use the first one as an example, for a flat fee of $3 per month, you get a ready-made WordPress install in under 1 minute, a 30 day trial (no card required), and a free domain name forever.

“Is there a catch”, you might be wondering at this point, and –

Which Method Should I Choose?

There’s no doubt that turning your computer into a server and hosting your own website from home could be a great experience…

…in educational terms. You will definitely get a much deeper understanding of the mechanisms that make the Internet tick, as well as learn to set up and manage a complex IT system with a clear practical result.

But is it worth it if you just need to host a website as cheaply and quickly as possible?

Not really.

While your software components and the hardware won’t cost you anything extra, the less obvious expenses quickly pile up to a sizeable $10-$20 per month.

Compared to that, a $3-$5 per month for a hands-off solution like the above mentioned Warpgate (or any other low-cost host) that does not require you to go through a 12-step setup process is something to consider.

***

Got any questions about DIY hosting and its alternatives? Have a personal experience of building a home server? Hit us in the comments below, let’s help everyone make more informed decisions!

Pour your heart out

1 comment

Hosting your website as a static or near static site on a Raspberry Pi computer solves some of the problems mentioned