Web Hosting

How to Host Your Own Website from Home


Have you ever wondered whether it’s possible to host your own website for free? Did you know you can turn your home computer into a WAMP server (Windows Operating System)?

We’re here to show you exactly how you can do so – our step by step guide will help you set up your own server so that you can host your own website on Windows WAMP.

How to install WAMP

There are quite a few different WAMP programs available, but for the purpose of this guide, we’re going to use WampServer which is completely free to download.

  1. Make sure you download the latest version of WampServer
  2. Select download and start the installation
  3. Navigate through the installation steps, keeping all of the default settings where prompted

Bear in mind that WAMP Server is quite a large program, so it may take some time to install and extract the necessary files:

You’ll be prompted to choose your default browser which WAMP will automatically locate for you:

If you want to choose another browser, click ‘Yes’ and locate it on your PC. The same prompt will apply for your default Text Editor which usually defaults to Notepad (again, you can change this if you want to).

You may be asked by Windows whether or not you want to allow Apache through your Windows Firewall; make sure you add a security exception for Apache via your private and public networks:

How to use WAMP

Once you’ve installed WAMP, a directory on your computer will have been created; this will most likely (if you didn’t change the default settings) be located at c:\wamp\www

After you’ve located your WAMP directory, you can create sub-directories, such as, Projects, which can contain HTML or PHP files within them.

Once you’ve launched WampServer, click on the icon in your system tray by left clicking on it to bring up the following menu:

Select ‘Localhost’ – this will launch a webpage in your chosen internet browser which looks like this:

You can also navigate directly to this page by typing in the following into any web browser: http://localhost/

How to create a HTML/PHP page

Now that WampServer has been installed, and it runs correctly, we can test it out! Using the same menu (by clicking on the WampServer icon in your system tray), select ‘www directory’ like this:

Using your text editor, create a new file and enter the following line of code, save the file in the www directory, and ensure the file extension is .php:

<title>PHP Test</title>

Navigate to the page you’ve just created by inputting the following into your browser (http://localhost/info.php) which should look something like this:

You can then repeat the steps above to create any HTML or PHP document within your www directory – pretty cool right?

How to configure MySQL

If your website relies on databases, you’ll need to configure your MySQL database. If you’re using WordPress or a similar CMS platform to create your website, then the databases should all be automatically set up for you.

Click on the WampServer icon in your system tray and select the ‘phpMyAdmin’ option which will open in a new browser window for you:

The default username should be root and the password field can be left blank unless you wish to change it. Once you’ve logged in, you’ll then have access to create new databases and change existing databases as/when you need to:

Making your website public (live)

Once you’ve created your website and setup your databases, you’re going to want to make it live so that the world can see it.

Go back to the WampServer menu and select ‘Apache’:

You’ll need to change the configuration settings to make your website public, as by default, they are set to private. Locate the Apache configuration file (httpd.conf), right click on it, and edit with your text editor.

Change the existing settings which should look like this:

And amend them to look like this:

Once you’ve performed the above steps, go back to the WampServer menu and select ‘Restart All Services’.

Hosting your website from home (Linux)

As well as there being a way to host your website from home on your Windows machine, you can also do the same on Linux. So, let’s take a look at how we can install Apache, PHP, and MySQL on your Linux system (LAMP).

How to install LAMP

Start by launching your Linux terminal:

Then run the following command in the terminal:

When you’re installing your LAMP software, you may be asked to confirm your MySQL password for the root user, so make sure you have this to hand in order to proceed.

If you make any changes to your Apache configuration, you’ll need to enter the following command:

Alternatively you can amend the configuration through your local .htaccess file.

How to check PHP

To ensure that your PHP server is working correctly, create a test version of your PHP file in your web server’s root directory like so:

Now launch your PHP test page by visiting http://localhost/info.php

This will display your PHP version, configs, and any installed modules you have. You can install more PHP modules using Ubuntu. If you’re not sure which modules you can install, you can download the graphical package manager here.

How to check MySQL

As we said previously, some (well, most) CMS platforms like WordPress use MySQL databases, so you’ll need to check that your MySQL installation works as intended in order to proceed.

Launch the terminal and check your MySQL installation by typing ‘service mysql status’. An example can be seen below:

If for any reason the above does not appear for you, you can restart the MySQL server by typing ‘sudo service mysql restart’.

Once your MySQL command line is available, you can manage your databases. Use the admin information you entered earlier when you installed MySQL:

Now you’re free to create your databases, or do anything you want with MySQL:

Most of the time your databases will be automatically created by your CMS platform, but if you want to manually make any changes, you’ll need MySQL.

If you’re not 100% comfortable with databases, you can use PHPMyAdmin which is user-friendly and allows you to manage your databases hassle free.

Further information on setting up your LAMP server can be found here.

Configuring your Domain Name (DNS)

If you’ve purchased a domain name, e.g. www.mywebsite.com then you’ll want to link that to your hosting, as you normally would with a web hosting provider, to your domain name provider.

Your domain’s DNS will have an A record pointing to an IP address – if you’re not sure how to access this, contact your domain name provider for further information (this is where you purchased your domain name from).

Once your DNS records have been setup, you can query your DNS by using a tool such as dig:

Configuring Apache

Once you’ve configured your domain name, you need to tell Apache about it in order to accept requests, and which directory to use. Before we begin, we need to setup the directory for your domain name, create a test index.html file, and setup permissions:

In order to be able to see the page created, you’ll need to setup a virtual host file:

Then edit the file to display the following (replace the examples with your actual information):

You’ll then need to tell Apache to reload in order to see your changes, so reconfigure it by using the following:

Navigate to your local hosts file (/etc/hosts) and add a line with your IP address and domain name from earlier – remember to correctly enter your details otherwise the server will not be able to connect:

Now you can go to your domain name, e.g. www.mywebsite.com and see your website live on the world wide web!

Pros and Cons to hosting your own website

Although it’s entirely possible, as we’ve seen, to host your own website without the use of a web hosting company, we wanted to cover the pros and cons of doing so.

Pros:

  • You’re completely in control of your server; you don’t have to share your server space with anyone at all, so your website’s performance and uptime is almost entirely within your control
  • Configuring your own server could be useful for the future. Even if you don’t use the server to host your own website, and you did it just for fun, the learning process could lead to a new career

Cons:

  • Unless your internet service provider (ISP) is running the same speeds as a dedicated server (unlikely), you’ll probably experience slow performance and connection speeds. If you’re uploading a lot of files to your website, depending on your upload speed, it could take a very long time to get your files live
  • Reliability is in some ways a pro, but more of a con. Unless you can guarantee that your computer won’t turn off, restart, or be prompted to perform a windows update (which you can’t guarantee), then your server will experience a period of downtime
  • As well as maintaining your own software and hardware, your computer will need to remain on at all times, so could end up costing you a small fortune

Options similar to hosting your website from home

If you’re not convinced that the pros outweigh the cons, when hosting a website from your home, you may be surprised that there are alternatives that are just as good. The main reason why people would want to host their own website from home is to have full control of their server, understandably. But as we’ve seen, in the long-run this can become very costly, time consuming, and isn’t always reliable. For beginners to web hosting, hosting your website from home is not recommended.

Web hosts now offer many different hosting packages that aren’t just your normal shared hosting, so you can still pay an affordable amount without losing too much of the control you’re after. For example, you could look at cloud hosting for fast speeds and high reliability, or dedicated servers that give you full control, but are more on the pricey side.

Conclusion

This guide provides in-depth step by step instructions on how to setup your own website hosting from home, using Windows or Linux – it’s possible, but not practical. As we said earlier, if you’re looking for a project, or simply want to learn more about the possibilities of website hosting from home, then it’s a great opportunity to sink your teeth into. However, the practicalities of doing so really don’t outweigh the cons in our opinion.

Firstly, you’re going to require a little technical know-how in order to begin the process; there’s lots of technical jargon that probably won’t make sense unless you have some background knowledge. Secondly, if you’re looking to run a popular high-traffic generating website, or even a business website, hosting it from home is going to be expensive. Your website will need to be online constantly, which means that your home computer will need to be both capable (performance and hardware wise), and never receive any updates to prompt a restart.

Windows updates can be a pain, however, they are there for a reason, for your own security. If you don’t update your operating system, you could be opening a big can of worms that could ultimately take your website and computer offline for good.

When you can get web hosting from as little as £1.50 per month it seems (if you don’t mind us saying) silly to do it from home. Web hosting providers are there for a reason; to provide a service for you, so you don’t have to go through the hassle. Perhaps in the future there will be a better way of hosting your website from home, but for now we would recommend not to – though it’s pretty fun to give it a shot!


View Comments
There are currently no comments.