Hosting your own website is an experience as entertaining as it is rewarding. Using an old Windows or Linux machine, you can throw a few HTML files into a folder and put them on the internet all by yourself, rather than going with the services found in our web hosting reviews.

It’s important to know exactly what you’re doing when hosting a site, though. Your computer will act as a server, a machine built with the purpose of storing and sending your data across the internet, allowing your site to appear to anyone in the world.

Essentially, that’s all web hosting is. Your machine is merely a tool for housing data and uploading it to the network. There are, however, some other pieces of software that ensure this process runs smoothly.

Before diving in, we’d like to make a note. We’re putting up this guide for educational purposes only. We don’t recommend you host your own website as it’ll bring too many performance and consistency issues. If you’re serious about putting up a website, try out Hostgator or SiteGround, two of our favorite providers for ease of use, pricing and speed.

Starts from $ 395 per month

How to Host Your Website at Home

We’re going to run over how to host your own website on Windows and Linux using your home machine and a normal desktop environment. Our tutorial will put up a test site for you, but it’s up to you to design it.

For our tutorial, we’re using the AMP stack. Don’t worry if you’re not familiar with this term yet as we’ll run through each of the technologies throughout the tutorial.

Hosting on Windows

If you have an extra Windows machine gathering dust, you can turn it into a web server. The process is fairly straightforward, aided by the AMP stack. This bundle includes Apache, MySQL and PHP, commonly referred to on Windows as WAMP. I’m sure you can discern why.

There are several installation programs, but we’ll use WampServer as it’s the most straightforward. Head to the site and download either the 32-bit or 64-bit executable depending on your OS.

If your machine has Skype running during the installation, you’ll get a port 80 conflict. WampServer and Skype both use port 80, so simply disconnect from Skype before running WampServer and you’ll be fine.  

It will automatically create a www directory which is usually found at “c:\wamp\www”. This is where your website (or sites) will live. Simply create a new folder in the directory and house your PHP or HTML files inside.

Before you do that, though, you need to test that WampServer is working properly. You can access the main screen of WampServer by either clicking on the link in the menu or opening a web browser and going to “http://localhost”.

Testing WampServer

Congratulations, your Windows machine is now a server, but it’s not really doing much right now. We need to test it to make sure that everything is flowing properly before adding your files and making them live on the internet.

We’ll make a simple test PHP file and put it into the directory. Open up NotePad in Windows and enter the following line:

<title>PHP Test</title>

Save that file as “info.php” in the www directory created by WampServer. Open your web browser back up and head to “http://localhost/info.php”. If you see a blank page with “PHP Test” on the tab name, then everything is running how it should.

Configure MySQL Databases

If you aren’t using a CMS like WordPress (you may want to read our guide on the best web hosting for WordPress, if you are), you’ll need to configure your MySQL databases. This is an open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL).

For a less acronym-focused definition, MySQL organizes the data of your site into a database that can quickly find and transmit it. A Content Management System (CMS) uses MySQL as a way to send that information off as efficiently as possible to the user.

You can alter existing databases or create new ones by clicking on “phpMyAdmin” in the “tools” section of the WampServer main screen. It’ll open a new tab requesting a username and password. The username will be “root” by default and you can leave the password field blank.

If you plan on using a CMS, you may never need to dive into this area. WordPress, for example, will create a MySQL database for you when it installs. Either way, it’s a bad idea to poke around here unless you know what you’re doing.

To ensure that MySQL is working properly, though, open up a new tab and go to “http://localhost/testmysql.php”. It will show you the IP address of your machine and let you know if the connection is okay or not.

Make Your Site Live

The Apache configuration file is set to deny any incoming connections by default. That means your local machine is the only one that can access your site. This is good for getting a test site running, but you’ll need to change the configuration once you’re ready to go live.

Go to the WampServer menu and click on “Apache” and then “httpd-vhosts.conf”.

This is your Apache configuration file, and it should have the following lines inside:

# Virtual Hosts


<VirtualHost *:80>

 ServerName localhost

 ServerAlias localhost

 DocumentRoot “${INSTALL_DIR}/www”

 <Directory “${INSTALL_DIR}/www/”>

   Options +Indexes +Includes +FollowSymLinks +MultiViews

   AllowOverride All

   Require local



To allow incoming connections, simply change “require local” to “require all granted” and you’ll be good to go.

Restart WampServer by selecting “Restart All Services” in the menu and the changes will take effect. You may need to double check that your PC firewall isn’t blocking web requests, but it should be set after that.

Adding a Domain Name

No one is going to memorize the folder hierarchy to access your website, though. You’ll need a domain name that points back to your local machine for easy input into any web browser. The server does so with DNS records.

You can read our article on DNS records to learn the specifics, but basically, it’s a system that ties your local IP address to a domain name. For example, if your server IP was 199.999.999, then the DNS records would know to access that server when your domain is keyed in.

Once you have an A record for your domain in the DNS records, you need to update your local host file. Go to “C:\Windows\system32\drivers\etc\hosts file” and add the following line to the bottom:

199.999.999.99 (your IP address) (your domain name)

For clarification, don’t include what’s in parentheses above. Next, you need to add a file manually into “C:\wamp\bin\apache\Apache-VERSION\conf\extra\”, where VERSION is your version of Apache. Create a file in NotePad with the following lines:

ServerAdmin [email protected]
DocumentRoot “c:\wamp\www”
ServerName mysite.local

ErrorLog “logs/”
CustomLog “logs/” common

Of course, replace “” with your domain name. Once that’s done, save the file in the Apache directory and your website will be accessible via its domain name.

Tips for Windows Hosting

While a normal machine will get you up and running, it’s the not the most ideal setup considering Windows is one of the more resource-intensive operating systems. Unless you have a lot of power to play with, you’ll need to optimize the operating system for web hosting.

The first step is to uninstall every application that you won’t be needing. While keeping a web browser around is crucial for accessing the WampServer control panel, nearly everything else can get the ax.

Next is to disable any startup applications that may be running in the background. There are a few that Windows needs in order to operate, so use your best judgment on which to disable. You can find the list in the task manager.

If you’re serious about using a Windows machine for web hosting, then it’s worthwhile to invest in a copy of Windows Server as well. This OS is much more lightweight, streamlined for running on any server whether it’s for web hosting or just for storage.

Hosting on Linux

If you plan on building a machine from scratch, then Linux probably the better choice. This lightweight piece of kit is the chameleon of operating systems, allowing you to adapt it to nearly every need.

The process is similar to Windows, except you need a LAMP bundle instead of a WAMP bundle. I’m sure you can figure out the difference. To retrieve the stack, open up the terminal and enter the following line:

sudo apt install apache2 mysql-server php libapache2-mod-php7.0

During installation, you’ll be asked to set a password for the “root” user. You can set it to whatever you want or just leave it blank. Once the installation is complete, you’ll need to restart the Apache web server.

You’ll need to do this any time you change the global configuration of Apache unless you do it using the local .htaccess files. To restart, enter the following command:

sudo /etc/init.d/apache2 restart

Check PHP

Like with Windows, we need to confirm the PHP server works before moving forward. We’ll use the same process as before by placing a test file into the www folder which, on Linux, is found at “/var/www/html/”. Create a file with the following line and place it in the directory:

sudo echo “” > /var/www/html/info.php

Head to “http://localhost/info.php” and see if the page loads. You should be able to see the PHP version, current configuration and installed modules here as well.


Configure MySQL

After confirming PHP is working, it’s time to check the MySQL databases. If you plan on using a CMS like WordPress, it’s important not to skip this step.

Open the terminal and enter the following line:

service mysql status

After a few moments, you should get this result:

$ service mysql status

  • mysql.service – MySQL Community Server

mrt 15 16:02:14 host1 systemd[1]: Started MySQL Community Server.

If the server isn’t working, just type in “sudo service mysql restart” to restart the MySQL server. After you get it working, you can use the MySQL command line client to manage your databases. To do so, recall the credentials you entered when MySQL was installed and enter the following:

$ mysql -u root -p

Usually, a CMS will install the database for you so you won’t need to fuss around here. However, there are a few things you can do manually such as create a backup of your databases. For those who want a more user-friendly way to do so, you can install PHPMyAdmin by entering the following line:

sudo apt install phpmyadmin

It’s an easy to use database management tool that circumvents the lines of code for managing your databases.

Configure Apache

The last step is to allow Apache to accept incoming web requests from the domain name in your DNS records. If you need help setting these records up, contact your DNS hosting provider as they should have an online tool for you to configure them.

Enter the following lines in the terminal:

sudo mkdir -p /var/www/html/

sudo sh -c ‘echo “<title></title><h1>This is my self-hosted site</h1>” > /var/www/html/

sudo chmod -R 755 /var/www/html/

This sets up the directory for your domain. You need to set up a Virtual Host file for Apache to see the page, though. Enter the following lines:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/


sudo nano /etc/apache2/sites-available/

Now, edit the Apache file to match this:

ServerAdmin [email protected]



DocumentRoot /var/www/html/

ErrorLog ${APACHE_LOG_DIR}/error.log

CustomLog ${APACHE_LOG_DIR}/access.log combined

Reload Apache for the changes to take effect by entering the following:

sudo a2ensite

sudo service apache2 reload

Like with Windows, simply add your IP address and domain name to your machines hosts file to match it locally.

Pros and Cons of Hosting Your Own Website

Not everything is great about hosting your own website, though. The cost-savings initially is about the only upside, but even that falls short in the long run.

Running your own server will rack up the electricity bill faster than you can say “shared hosting.” Since your server will need to be turned on and connected to the internet all the time, the cost will actually end up far higher than buying an inexpensive web hosting plan.

That’s not even considering the potential for outages in residential areas. If, like me, your area is prone to frequent outages, your website’s stability will be all over the place, especially without a high powered ISP to back it up.

Costs are high, but the practicality of hosting your own site just isn’t there. Your website will be victim to slow connections, hurting it in Google search rankings and turning away potential visitors. While many inexpensive hosts deal in the one to two second range, a residential connection will probably deal in the 15-20 second range.

The process of putting your own website online is best used as an educational tool to understand how web hosting works. By exposing yourself to all the tools, you’ll be able to configure your site better with an external host.

If cost is a concern, check out our list of the best cheap web hosting where we break down providers that give excellent service at decent rates. Our favorite option there is iPage.

However, hosting your own website is certainly an option for staging or if you plan on running a small WordPress blog. If that’s you, make sure to check out our guides to using WordPress. 

Starts from $ 199 per month


Hosting your own website is about as much fun as a geek (like myself) can have. It’s an opportunity to play with new tech toys on old hardware and learn more about the web hosting world and how it functions.

Unfortunately, that’s its best use. Unless you have some serious power behind your server, it’s difficult to make hosting your website a viable option, both practically and monetary. For that, we’ve ranked the best web hosting providers, so you can make an informed choice.

How did your home hosting experience go? Let us know in the comments below and, as always, thanks for reading.

Was this post helpful?

7 thoughts on “How to Host Your Own Website”

  1. that’s mean we cannot turn off the computer even at night? What if we turn the computer off??

    1. - Chief Editor

      No website. You need to get a second computer and have that act as a server.

  2. So basically if I wanted a single layout webpage like a business card and small description of my services this is the best way to go? No links just a synopsis and phone number or email address you can send to with a simple layout and logo and maybe a few pictures reduced in filesize for easy loading.

    1. - Chief Editor

      Yes, that’d work, but if I were you I’d still get a web builder as it’d cost roughly the same as hosting the page, and you wouldn’t have to learn to code or nothing. Also, the page would look a lot better, to boot.

  3. Considering that a simple webserver can be run on a Raspberry Pi and with an external storage unit to host DB’s and larger amounts of data, I don’t really see a good argument behind the electricity bill. After all, most of us geeks already run at least one machine at home that most likely runs 24/7 or close to it anyway, even if it’s doing nothing.

  4. Damir is correct. I am running a small website using Python, Flask and SQLITE on a Rasp. Pi 3.
    It’s not noticeably slow despite copper wire line connection. Electricity consumption insignificant.

Leave a Reply
Your email address will not be published. Required fields are marked *

Also interesting
Best Cloud Storage for Sharing 2019: Top Cloud File Sharing Solutions Compared
Fastest Web HostingFastest Web Hosting of 2019: Shaving Those Milliseconds
endurance international groupEndurance International Group: Enduring Web Host or Privacy Pirate?
Namecheap vs BluehostNamecheap vs Bluehost: Going Toe-to-Toe in 2019
Most popular on Cloudwards
Free Cloud Storage in 2019: Top Five Providers with Large Free Service Plans
Best of The Big Three: Dropbox vs Google Drive vs Onedrive
How to Beat the Netflix VPN Ban
How to Unblock YouTube: Video Streaming for Everyone