Web hosting is a service which allows a website to be accessible and available on the internet. There are multifarious web hostings services available on the internet like Shared hosting, VPS hosting, Cloud hosting, Dedicated Hosting and many more.
But, have you thought of hosting your website on your computer? Yes, it is feasible to host a website on your personal computer. Isn’t that interesting!
But, unfortunately, there are some inhibitions which you will face in this exciting process of making your personal computer a web host.
These pangful inhibitions will include scalability, security, allocation of dynamic IP address, bandwidth restrictions, electricity costs, etc.
In this article, we will step by step learn how to host a website on Microsoft Windows and also on Linux. We will also discuss some disadvantages of making a personal computer a web host.
How to host a website using Windows
Now, hosting a website using Windows is not much difficult. The first and foremost thing, you will need in this process is a WAMP server. So, before we move forward lets first know about WAMP.
What is WAMP?
WAMP server is a contracted abbreviation of Windows, Apache, MySQL, and PHP.
When you download a WAMP Server, it will automatically install Windows, Apache, MySQL, and PHP. It installs all the applications as mentioned earlier automatically. Otherwise, you will have to install these applications manually by yourself.
Now, let’s understand these terms in brief:
Windows- The “W” in WAMP stands for Windows. It shows whether the AMP applications ( Apache, MySQL, and PHP) installed are compatible with the Windows operating system or not.
Apache– Apache is the main program that actually hosts a website. Through using it alone, one can host HTML files as well as other static web documents on your computer.
MySQL– MySQL provides a database where all the web content of a website remains. Data like usernames, passwords, emails, etc. are stored in this database only.
PHP– PHP is one of the most popular and renowned languages, used for creating dynamic web content. Even popular websites like Facebook, WordPress, etc. use PHP.
Step 1: Install the WAMP Software on your PC
Firstly, you have to visit the official WAMP website and download the latest version. Then choose 32 or 64 bit as per the compatibility of your operating system.
Then you will see installation prompts which are self-explanatory, so just follow the on-screen instructions.
Now, just keep everything at default and nudge the Next button every time you see it.
Finally, it will install all the latest compatible version of AMP applications on your PC. Now, you can choose a browser of your choice. Or you can also use your default Pc browser by merely hitting the “open” Button.
Note: In this process, you might face some issues related to the Windows firewall and Apache. You might notice, that some of the features of Apache might be rejected by your windows firewall.
So, make sure to add the security exception for Apache in your Windows Firewall.
Now, after the installation is completed, mark the box labeled as “Start WampServer 2 now” before eventually clicking the “Finish” button.
Step 2: Navigating/ Using the WAMP Server
Once the installation is completed, a www.directory automatically gets created in local disk C ( c:\wamp\www). So if you want to change the pages displayed to you, you can do it from here.
Even, here you get the option to create subdirectories (called “projects” in WampServer). You can also put any PHP or HTML files in these subdirectories.
Like for example, if you install WordPress, all its installation files get saved in these directories only.
Step 3: Create a PHP or HTML Page
By creating a PHP or HTML page, we can test our Web server. Now, we can simply create a PHP or HTMP page by using any web development program such as Notepad.
You can put any file in the directory. It’s just you have to add the extension .php (e.g. “info.php”). Make sure you set the destination of your file to be c:\\wamp\\www.
Now just simply return to your web server and nudge the refresh button for the settings to get updated.
Now, you can further test it by going to (https://localhost/info.php) through your web browser. Hence, once you enter the mentioned destination, your browser will take you to the new web page you just created.
Step 4: Configuring MySQL
You can click on the PhpMyAdmin menu option to configure your MySQL databases. Once you click on it, it will take you to a new browser window.
Here you will see the admin username and default password. The default password is “Root,” you can change it or skip it to change the password later.
Here, you can also create or customize new MySQL databases or even construct new ones. However, most CMS software, like WordPress, automatically provides a database by default.
Step 5: Making the Website Public
Actually, by default, the Apache configuration file is set to deny any incoming HTTP connections which means your website is accessible just to your computer.
So, to make it public, click the WampServer icon and choose the “PutOnline” option.
But, it will show a “403 Forbidden” message when somebody clicks on your URL link. Now, you can rectify this problem, by changing two lines of code within the Apache configuration file (httpd.conf) settings.
Simply, locate the (httpd.conf) file in your WampServer menu in the Apache folder. Now scroll down till you come across a code shown below
1 Order Deny, Allow
2 Deny from all
Just delete and replace it with the code mention below:
1 Order Allow, Deny
2 Allow from all
Now, you are almost done, so now just restart all the services in WebServer. You can do it through the dedicated button available on the menu. Now you are all done, and your site is now accessible and open to everyone on the internet.
Note: Make sure you change your PC firewall settings that block web requests. You should also put forward the port 80 to your PC on your router.
How to Host your Website on Linux?
Just like on Windows, you can also host a website using Linux. In Linux too you need to install MySQL, Apache, and PHP. Now, similar to WAMP in Windows, LAMP WebServer is used in Linux. It provides you with all the three essential web-hosting applications.
Step 1: Install the LAMP Software
You can start the installation of LAMP software by typing the following command in the terminal:
( sudo apt install apache2 MySQL-server PHP libapache2-mod-php7.0 ).
During the installation process of LAMP software, you will need to enter a password for the MySQL root user. You shall set the password here, or you can also leave it. But if you left it, you will not be able to change the password later.
Note: Everytime you change the configuration of Apache, you will need to execute the command: ( sudo /etc/init.d/apache2 restart ). However, you can also do the configuration using local .htaccess files.
Step 2: Testing the PHP
You can confirm if your PHP server works or not by inserting a test PHP file into the WebServer root directory ( /var/www/html/ ).
For example, you can create a test PHP web page named “info” and then enter the following command into the web server root directory: (sudo echo “” > /var/www/html/info.php).
Now, go to your browser and enter (https://localhost/name.php) into it. Hence, after loading, it will show you your test PHP file along with the running PHP version, configuration, and available modules.
You can also check for extra available modules within your the graphical package manager by entering the command: (apt search php | grep module).
Step 3: Test MySQL
Now before moving forward, you should check whether MySQL installation was successful or not. Testing MySQL is of paramount importance as if MySQL doesn’t install correctly, many CMS systems such as WordPress will not run.
You can check MySQL by entering the following code: (service MySQL status).
In case after entering the code, MySQL doesn’t work, then restart the MySQL server by entering the following command: (sudo service mysql restart).
The second thing, you should do now is to check if your bind address. It should resemble with your system address. You can do this by simply entering the command: (cat /etc/hosts | grep localhost).
Once you are done with it, you can make use of the MySQL command line client as a tool for the management of the databases. You are now free to manage the MySQL on your own and can also create new databases if you want.
Step 4: PHPMyAdmin Installation Process
PHPMyAdmin is a user-friendly tool which is of great use when it comes to the usage of MySQL and its commands. It provides with an interface for the MySQL administration. It is a highly recommended database management tool for those who are not familiar with MySQL and its complex commands.
You can easily install the PHPMyAdmin by typing the following command into the terminal : (sudo apt install phpmyadmin).
You can also login into phpMyAdmin by entering the following address on your browser: (https://localhost/phpmyadmin/).
Step 5: Configuration of DNS
You can use your domain ( for example yourname.com) for your web server. For this, you will have to configure your Apache to allow web requests for your domain.
So to do this, firstly, make sure that your desired domain name has an ‘A record’ which will point to a specific IP address. The records of your DNS gets automatically updated through your DNS hosting service provider.
You can also check whether the configuration was successful or not, by using the ‘dig tool.’ It will show you the details containing your domain name, IP address, and also an authority section.
Step 6: Configuration of Apache
Now we have come to the last step, and here we will have to configure the Apache to accept all the web requests for your domain name (www.yourname.com) on the internet.
Here, i will discuss some of the essential hosting configurations. Firstly, you will have to disable the ‘Apache virtual host default’ by entering the command: (sudo a2dissite *default).
You can go to the default storage directory by entering the command: (cd /var/www/html). Here you can establish a new folder which will host your website.
Now, make sure you have changed the domain name to your desired domain name. For this, you can use the command line: (sudo mkdir desiredname.com).
Now, open the folder which you have just created and here you can also create sub-folders or directories. These subcategories will serve your purpose of storing weblogs, files, and backups, etc.
After doing this, open a new virtual host file by entering this command line:
(sudo nano /etc/apache2/sites-available/desiredname.com.conf).
Now, you will need to build a configuration for your virtual host. For this, you will have to make use of the block of codes mentioned below:
Directory_Index index.html index.php
Custom_Log /var/www/html/desiredname.com/log/access.log combined
Now, to save these changes, you will have to press the control button + X followed by Y. Now just press the Enter button to add the above-done changes to your virtual host configuration file.
Finally, enable your website through this command: (sudo a2ensite desiredname.com.conf).
So, now you are done with the configurations, and your Apache is ready to hold your website.
Disadvantages of hosting a website on a personal computer
Before you commit your computer to serve as a web host, you should understand the various demerits of doing it.
1) If you want other users outside of your network to reach to your website, you will have to put forward your Port 80 on your router which can be risky and can violate your ISP’s terms of service.
2) Secondly, by chance, if your traffic increased notably, then your ISP might drop you or even take legal action against you.
3) Even using your personal computer as a web host is not security proof as it can be easily breached and hacked. So, you should make sure that you have a basic understanding of firewalls and security.
4) Now, your Web server will have to be always Online. So to ensure this, you’ll need a computer which has to be always-on. So, it further means that your laptop or desktop won’t be good enough.
5) We might use our personal computer to host a website, but in reality, it is not specifically dedicated to hosting a website. Hence, there are demerits of doing so, like in case your website traffic increases, you will be left with hardly any scope of expansion.
With the increase in traffic, you will need more bandwidth, storage, power, and data space but a personal computer in such a case will not prove to be efficient enough.
6) As soon as we turn our computer as a web host and installs the web server software on it, we unintentionally also allows other users on the internet to have access to our network.
So, it would not be wrong to say that we are inviting hackers and automated malware to our computer. This is why people prefer web hosting companies over self-hosting a website as they provide robust security.
Over to you
Hosting a website on your personal computer using either Windows or Linux is possible. You can easily do the same by following the above-mentioned lucid and easy steps.
But, as discussed above, there are some significant disadvantages of using a personal computer as a web host too.
And so, as there are various risks involved, you might meditate other alternatives to self-hosting a website.
The glaring alternative to self-hosting a website is looking for other web hostings like virtual hosting and dedicated hosting. These web hostings are more reliable, secure, user-friendly and even more scalable as compared a self-hosting.
Virtual hostings are quite cheap as compared to dedicated hosting and thus are the most feasible solution for a small business or website.
Some of the cheap and dependable Virtual hosting companies are Bluehost, Siteground, and InMotion Hosting, etc.
But personal computer comes handy for website hosting in case you are looking for a cost-effective way especially targetting to learn hosting skill or to do some testing. Despite several demerits, it gives you more control and flexibility.
It’s upto you, whether you want to morph your computer into a web host or you go for a web hosting service provider. But we can only say “Happy hosting”!