Alex Williams
Alex Williams  —

Last updated:

Share this Post

Amazon, Microsoft, and Google are exceptions for being totally self-hosted. 

But even the most succeseful tech giants - like PayPal (which uses Google Cloud hosting) and Netflix (hosted on Amazon AWS servers) - use third-party web hosts to power their online operations.

To reliably self-host, you need financial and technical resources. So before this hands-on approach, consider a cheap host. Hosting yourself will mean maintenance is entirely up to you, connections are more reliable and slower, and need to have your computer on around the clock.

That said, here’s how to host your own website from home: 

Pro Tip: Self-hosting isn’t for beginners to web hosting. While free hosting is attractive (for obvious reasons), there are serious performance/time costs.

1. Use Your Windows PC as a WAMP Server

Let’s start with how to host a website using a Windows-based personal computer. 

Keep in mind that two-thirds of all sites don’t use Windows as an operating system. You’ll have fewer functionalities than Linux developers do. It’s your best option however if you code in C and ASP.NET.

Step 1. Set Yourself Up With WAMP 🧰

The easiest way to start is to use a WAMP installation program such as WampServer. This sorts out your PHP, MySQL, Windows, and Apache. Installing it manually is possible but high-risk for bugs.

You can download the 64-bit or 32-bit WAMP-binary with this link, then go through the on-screen guide, and finally execute WampServer once it’s downloaded. (Pro Tip: If you have Skype, you may come across a port 80 error, but there’s a working fix for that.)

wamp download

The installation process automatically generates a www directory. You can probably find it here: C:wampwww

Next, create subdirectories (which WampServer names “projects”) in that directory, then drag any PHP or HTML files into those subdirectories. Also, if you want to go to WampServer’s main screen, probably get there by bringing up your internet browser using the URL http://localhost

Step 2. Make an HTML Page to Configure MySQL 📁

Let’s check that WampServer is working correctly.

To do this, put a test file (let’s name the file “info.php”) into your www-directory. In order to get there, head into the WampServer menu and choose “www directory.” Once inside, make a new file containing the sample code and save it.

info php

Now by browsing http://localhost/info.php you’ll be able to see information for your PHP installation. Formulate any PHP or HTML structure to fit your project’s needs.

For the configuration of your MySQL database (which many content management systems like WordPress use), choose the PHPMyAdmin menu selection. With the login screen appears in a separate browser window, use your admin username as the root, and leave the password field blank.

Finally, you can then make your MySQL database and modify the pre-existing ones; however, you’ll normally automatically be given a new database when you set yourself up with something like WordPress.

Step 3. Make Your Website Public 🏢

Everything we’ve done up so far will be only visible by you. When everything looks good, head to ‘Apache’ and choose the ‘httpd.conf’ file—in order to make the site public.

httpd conf

Your Apache configuration file is by default configured to block incoming HTTP connections, other than traffic coming from the localhost.

By editing the file mentioned above—which you find in the WampServer menu, by choosing Apache, then selecting httpd.conf—we can unblock incoming connections by making sure the settings read as the following:

Order Allow, Deny

Allow from all

...and now you're live!

Step 4. Pointing Your Domain ☝️

Let’s let regular users find your website in a typical fashion, by searching for your domain URL in their browser of choice, as they would with any other website.

Step one is to configure your domain name DNS settings. Talk to your customer service chat team in your domain registrar of choice. The goal is to link your IP address to the DNS.

If you have a direct Internet connection with your computer, then you’re already done.

For those using a router to connect to the internet, you first need to forward your ports. For this, log into your router’s admin interface by typing the router’s IP address into your browser address bar.

The next step is to find an option on your router’s interface that will either be called NAT, virtual server or port forwarding—depending on its manufacturer. And forward your HTTP or web traffic to port 80. Make sure that in the IP address field you input the IP address of your machine on the local network.

This is so your personal computer can be identified on the local network.

Once done, save changes and restart your router.


2. Linux: Host Your Website by Using a Linux Machine

This session will go over how to set yourself up for PHP, MySQL, and Apache using a Linux operating system. LAMP stacks are by far the most used Linux configuration for hosting but there are other trustee solutions that use LiteSpeed servers or NGINX.

Step 1. Install LAMP software Using the Terminal 💻

In this section, we’ll teach you how to create a LAMP (Apache, Linux, MySQL, and PHP) server.

creating lamp web server

It’s mostly the same method as WAMP but for a Linux machine. To begin, type the following command into your Linux Terminal:

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

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

Once installation of the LAMP software is completed, you may be asked to enter your MySQL password. Then we’re ready to do your server configuration. 

Step 2. Reviewing Your PHP, MySQL and DNS 🗄️

Before letting visitors use your website, it’s good due diligence to make sure your MySQL and PHP are performing properly. For this, follow the methods that we went through for WAMP. The aim is to add files to the directory so that they pop up on your site. Just make sure you’re using the .php file extension. 

Note that, during the installation process, you’ll need to provide a password for the MySQL root user. If the installation didn’t restart your computer, make sure to do it now. Then restart the Apache webserver. 

You can also validate whether your PHP servers are working correctly and what PHP modules are payable for use by placing a test PHP file into the Web server root directory (head to /var/www/html/). This will let you know what version of PHP is running. 

If your content management system uses MySQL, it’s also good practice to make sure that the installation successfully worked alongside updating your MySQL. This should mostly be handled by your CMS. But if you need to do manual alterations, something like PHPMyAdmin is a user-friendly way we’d recommend to use.

Finally, by default LAMP blocks incoming requests to your domain. Repeat the process as given in the WAMP section for allowing this traffic.

Step 3. Setup Apache 🛠️

You’re almost there. The last step is to let Apache know that it should accept requests for your domain name. To do this, set up a directory and modify file system permissions. 

Now you know how to host your own website on Linux. 


3. Upsides and Downsides of Self-Hosting

how to web hostingEven though it’s possible to host your own website, this doesn’t mean you should. 

We recommend this for those with a hard-core technical personality. And for those who are interested in learning more about how their website operates on a more atomic level.

Otherwise, it’s best to steer wide away from self-hosting. Even successful self-hosted websites are typically fragmented HTML infrastructure with severely limited scalability. To summarize:

Benefits of Self-Hosting ✅

  • The main benefit of setting up your website and hosting it is that you will learn a lot, and have some geeky fun with executing different tricks, to see what works. If you’re still reading this post, you’re probably among the demographic who would call technical and potentially buggy missions interesting. 
  • Once you master the process, you’ll be able to create your own system and variations. Many beginner technicians started with learning to host a site locally to become experienced in web design, programming, and inter-related fields. Getting unusual powers and atomic experience is the main upshot. 

Downsides of Self-Hosting ❌

These, unfortunately, outweigh the upsides to self-hosting your website:

  • Expect lots of sluggish connections compared to professional web hosts. Your ISP’s upload speeds are much slower than typical download speeds. So any website visitors to your website will also experience those slow speeds.
  • Your IP address will also be dynamic and so change constantly. You can limit this to some degree with DNS configuration tools, but this can cause frequent issues.
  • There are also the electrical power costs and the risk of power outages.
  • Finally, you are responsible for the maintenance of your software and hardware.

So it’s obvious why we typically recommend using a quality web host, or reseller hosting for bulk distributions. While good learning experience, so forcing is not practical for serious operations. 

We hope this ‘how to host your website’ guide was valuable to you. 

You Might Also Like: