Pros and Cons of Hosting Your Own Website at Home

Last Updated on February 16, 2024 by James Wilson

How to Host Your Own Website

Thinking about hosting your website? If you’ve created your website and would like to make it public on the World Wide Web, then you’ll need hosting. Website hosting can either be done from your PC or by a hosting provider. However, there are many things that you’ll need to know before you decide on what option is best for you. 

You’ll need a domain name for starters. You can get a domain name for free, however, it might not be the sort of domain name you are looking for. A professional domain name can cost anything from £0.99 to tens of thousands. 

The easiest and cheapest way to get your website online is by buying shared hosting from a hosting provider. Shared hosting is when you rent out a portion of a server. The amount of space you need will vary from one website to the next. For example, a website with a large database and a lot of data going in and out is best placed on a Virtual Private Server or a Dedicated Server. On the other hand, if you’re just starting then you could get away with shared hosting until you know what your bandwidth usage will be. 

Why Would You Want to Host Your Own Website?

Let’s address this question for a start. You need hosting to make your website public, however during web development then it is easy to create and host your local machine. That way you don’t need to upload and download files to an external server until you are happy with your website. 

There are several pros and cons to hosting a website on your machine vs hosting with an actual website hosting company.  Hosting your website yourself can be very rewarding, however, it can be a daunting procedure. In this article, we’ll go over how to self- host your website, as well as the pros and cons of each approach to website hosting. 

Think of your web hosting is the home for your website. It needs an (IP) address, enough space for your business to grow, somewhere to store all of your files, to be online 24/7 and security measures to keep your online presence safe. Additionally, you need the functionality of various types of software to ensure that everything is running smoothly. 

Without further ado, let’s dive into how to make your hosting server from home or your office. 

How to host a Website using a Windows PC

Hosting a website on your computer can be rewarding, especially if you’ve made your website from scratch. Watching a website develop from idea to reality is always a thrill. You’ll need a WAMP server to host your website on your WindowsOS.

What is a WAMP Server?

WAMP is fairly straight forward and easy to understand. WAMP stands for Windows, Apache, MySQL, and PHP. This type of server environment is perfect as it installs all of the required software in one go. The “W” is the Windows part of WAMP, therefore if you’re looking to create a website in Linux then you’ll need to go for a LAMP server environment, where the “L” stands for Linux. Lets’ look a bit deeper at the “AMP” piece in the WAMP server environment. 

Apache – the “A” in WAMP is the apache piece. Apache is the core program that performs the hosting services. The full name is the “Apache HTTP server”. Apache is a free open-source web server software that is maintained by the Apache Software Foundation. Apache powers around 46% of all websites globally. Apache is cross-platform and works on both Unix and Windows. Apache is responsible for a smooth secure connection between the two machines.

MySQL– MySQL is the type of database used to house your web files. There are many uses of a database, basically, the database stores all of the web content, making the website dynamic (and hopefully) faster to access. Membership sites that need a login or eCommerce store require a database to function. 

PHP– PHP is the programing language that will be used on this server. PHP is a server-side programming language that can be used to produce both static and dynamic websites. You need to install PHP for your server to recognize the PHP programming language.

Awesome, you now know all about WAMP and why it is 100% required before you can host your website on your PC. Let’s now get started with the practical aspects of getting your PC to host your website. Firstly you need to install the WAMP software. 

Step 1 – Install WAMP Software

Go to this link and download the WAMP Software. 

Step 2 – Run WAMP Software

Double-tap on the downloaded WAMP software and run the .exe file. Simply select next and keep the default settings.  Choose your browser selection or select open to open your default PC browser (in my case that would be Google Chrome)

PRO TIP: Your PC’s firewall settings may reject some of the security aspects of the WAMP environment. You’ll need to make an exception to bypass the security alerts. 

Once WAMP has fully installed – fill in Start “WampServer 2 now” checkbox and then hit “Finish”. 

Step 3 – Managing your WAMP Server

You can change pages and create subdirectories by going to the local disk C “c:\\wamp\\www”. To check if your changes are live, refresh your browser. 

Step 4 – Create an HTML or PHP Page

To create an HTML or PHP page you can write the code in a notepad or syntax editor like Sublime. Using a syntax editor is much easier as you can color-code your text. When you save your document, go to “save as” and then give it a .php extension (eg. Projectname.php). Your saved file should be in

c:\\wamp\\www file location. 

Step 5 – Test Your Code

Check that you’re code is working and all changes have been made by going to http://localhost/Projectname.php – hit refresh to push changes through to your browser. 

Step 6 – Configure your MySQL Databases

When you open WAMP you can go to the menu and open the phpMyAdmin panel. In phpMyAdmin, you can open a new window and you’ll need to input a root password. If you want you can leave the field empty or set a password.  I use XAMP with phpMyAdmin rather than WAMP, when I open the admin it looks like this.

If you have WordPress then you’ll automatically be allocated a database. 

Step 7 – Setting Your Website to be Public

It is regarded as bad practice to use your home PC as a hosting server, mainly due to safety concerns. Using your local machine as a dev environment, on the other hand, is best practice. If you want to go for it an make your website publicly visible then double-tap the WampServer icon and then a dropdown will appear – select “Put Online”.

The second part of setting your website to be public is fixing a few lines of code in the Apache settings. If you don’t do this part then your website will show a “403 Forbidden” warning message. 

Find the httpd.conf file in the WampServer menu inside your Apache folder. Scroll down and you should see the following:

[code type="bash"]

Order Deny, Allow

Deny from all

Order Deny, Allow

Deny from all

[/code]

You need to delete this text and replace it with:

[code type="bash"]

Order Allow, Deny

Allow from all

Order Allow, Deny

Allow from all

[/code]

Step 8 – Change Security Settings 

Change your firewall settings as they will block web requests. You also need to forward port 80 to your PC router. Check the manual that you got with your router if you need more information on this section.  

 Step 9 – Restart Services in WebServer

Once you have completed Step 7 then it’s time to restart your services and see your website online. 

How to host a Website using a Linux PC

If you are looking to set up your website hosting on a Linux PC then you’ll need to set up a LAMP environment, as I mentioned above. This is how to set up your hosting on a Linux PC. 

Step 1 – Install Software Using the Terminal/ Command Prompt

First, open a new terminal/ command prompt and enter the following:

sudo apt install apache2 MySQL-server PHP libapache2-mod-php7.0

You’ll be asked to enter your password for MySQL. To check – restart the Apache server. Every time you change global configurations execute the following command (using .htaccess files)

[code type="bash"]

sudo /etc/init.d/apache2 restart

[/code]

Step 2 – Check Your PHP Server is working

It’s a good idea at this stage to make sure that you’re PHP server is working by adding a file in the PHP web server root directory. The file is simply a text file, that should have the following code, and should be added to (/var/www/html/):

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

Go to your browser and paste the following URL – http://localhost/info.php

When you do this you should see a screen that shows you information about the PHP instance you are running as follows:

This will show you all of the modules that you are running, so you can go back here in the future if you want to find out more information about your PHP instance. 

Step 3 – Check Your MySQL Database is working MySQL

MySQL databases are required for the majority of sites out there. You can get static sites that don’t dynamically update, but these sites are almost unheard of these days. Some landing page software like Clickfunnels doesn’t use MySQL – but for this example, let’s go in and check that your MySQL databases are running. 

Open a new terminal window and add the following code:

[code type="bash"]

$ service mysql status

mysql.service – MySQL Community Server

[…]

mrt 15 13:24:09 host1 systemd[1]: Started MySQL Server.
[/code]

You should see that the MySQL server has started. You can manage your MySQL in the command line to manage your databases. 

To restart your MySQL server enter the following:

sudo service mysql restart

You’ll need to use the admin details that you set up when you installed MySQL. You can get to the login screen by typing the following:

[code type="bash"]

$ mysql -u root -p

[/code]

PRO TIP: A lot of CMS software (like WordPress) auto-installs a MySQL database for you. 

Step 4 – Manually Create Databases

You can use PHPMyAdmin to create and manage your databases.  To install PHPMyAdmin enter

sudo apt install phpmyadmin

Finally, configure the /etc/phpmyadmin/config.inc.php file using the steps described here.

Step 5 – Using Your Domain Name

If you want to use your domain name for your website, then you’ll need to configure the DNS. Visit the domain name registrar that you bought your domain name from. 

You can buy a static IP to map your domain name or use dynamic with dnydns. As long as you have a static IP address on your local server, then you should be able to map your domain name DNS to your home IP address if you have configured your router. 

Step 6 – Configure Apache

You need to let Apache know where to find the directory to show to your website visitors. For this example, we’ll use yoursite.com as the domain name. Firstly, create a directory and create index.html. Then set up file system permissions as follows: 

[code type="bash"]

sudo mkdir -p /var/www/html/yoursite.com

sudo sh -c 'echo 

<h1>This is my self-hosted site yoursite.com</h1>
/var/www/html/ yoursite.com/index.html sudo chmod -R 755 /var/www/html/ yoursite.com

[/code]

You’ll now need to set up a Virtual Host file so that you can see your webpage. 

[code type="bash"]

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

sudo nano /etc/apache2/sites-available/ yoursite.com.conf

[/code]

Edit the file so that it looks like this:

[code type="bash"]

ServerAdmin admin@ yoursite.com
ServerName yoursite.com
ServerAlias www. yoursite.com
DocumentRoot /var/www/html/ yoursite.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
[/code]

Reload Apache to view the changes that you have made:

[code type="bash"]

sudo a2ensite yoursite.com.conf

sudo service apache2 reload

[/code]

Edit your local /etc/hosts file by adding a line with your IP address and domain name. Be sure to change the “100.100.100.100” to match the IP address of your domain:

[code type="bash"]

100.100.100.100 yoursite.com

[/code]

Brilliant, that is everything now set up – go to your domain name http://www. yoursite.com (where yoursite.com is replaced with your domain name) and your site should be live.

PRO TIP: Your DNS can take up to 24 hours to configure, to make your domain name work. 

Pros and Cons of Hosting Your Own Website at Home

Pros
  • Rewarding experience
  • Great to create your website locally and check how it appears online
  • Educational, giving you an in-depth knowledge of server environments and code
Cons
  • Dynamic IP Addresses
  • Bandwidth constraints
  • Electricity costs
  • Security issues
  • Slower than professional hosting
  • You need to deal with your dynamic IP address or buy a static one. 
  • Power outages could mean downtime
  • You are responsible for maintenance

All in All

The whole process of creating a server and hosting your website is extremely educational, but it does come with a tonne of downsides. Self-hosting is not recommended for anything other than development environments. However, it can be a fun project to take on if you are a bit of a tech geek.  Professional hosting services come with a whole host (pardon the pun) of features that make hosting cheap, easy, secure, reliable and all in all more fun than having to take on the responsibilities that come with creating your server environment. 

[/vc_column][/vc_row]
Share this

Leave a reply

Recent Blog Posts

No matter what type of non-profit you run, it is important to have an online presence so that you can
Although the name might not suggest it, subdomains are actually part of your main domain name. They are designed to