How to Create Your Own Server at Home for Web Hosting

Last Updated on

Mirza Mussawer
Mirza Mussawer

Creating your own website is an exhilarating experience. You get to learn numerous software technologies and frameworks such as Mongo DB, Express.js, Angular, React and Node. If you want to host it on a home server, then you should know how to create your own server at home for web hosting. And this post will give you everything you need to make that happen without a glitch.

Learning how to make a server (at home) starts with putting together the necessary software and hardware. Following is a precise and concise list of what you will need for to create a home server.

1. CPU

You can start with even a simple Core 2 Duo to get things started. However, if you expect to have a high amount of traffic (greater than 1,000 visitors), then it is recommended to go for better processors. This will give it more processing power and cut the costs of upgrades.

It is recommended to go for a 5th generation i-5 or higher for a mid-ranged spec web hosting server. You can choose mobile processors (denoted with an m with their model number) to reduce power consumption and thermal output. However, they will not offer the same processing power.

2. GPU

In most cases, a home server does not require a GPU. It must be noted that servers do use GPUs to support graphic intensive applications. Common examples are gaming servers and photoshop applications. Compared to these, your web server at home will be (in most cases) relatively simple and will not need a GPU.

3. RAM

Anything starting from 1 GB will do. There are several different brands to choose from, such as Seagate, Corsair, Kingston, etc. Since the server will run 24/7, consider multiple low power RAM sticks (denoted with an L with the model) to compensate for the drop in MHz.

The cost of RAM has gone down significantly in recent years and you can easily find cheap sticks starting from 4 GB onwards. Your server will have a much better response time with concurrent users with higher RAM.

4. HDD or SSD

You can plug that old 256 GB hard drive collecting dust on the shelf into your build for starters. Your storage is one of the last things you need to worry about for your home server. It holds the general files, source code for your website, OS and web server configurations.

Opting for SSD provides numerous benefits, such as faster read/write operations, searching and improved overall performance.

5. Motherboard

A server really needs a quite basic motherboard to get things started. What really matters is that you ensure there are no bottlenecks. For example, you may have installed a DDR4 2133 MHz RAM, but your motherboard slot may only support a DDR3 1866 MHz one at max.

The same goes for your processor, where things get more complicated. Some processors may not plug into the same slot owing to differences in their die size and pins. You should also know how to make a server (at home) yourself by assembling all the parts together.

6. OS

The most popular OS are Ubuntu and Windows. 67 percent servers use Linux, as it is reliable, stable and open source. This means fewer operational costs incurred from licensed software.

For homeowners, there are 2 stacks: WAMP and LAMP. The AMP in both stands for Apache Server, MySQL Relational Database and PHP programming language. The W and L in each stand for Windows and Linux.

Alternate: Raspberry Pi 3

Raspberry Pi is a series of mini-computing boards that come with integrated resources on a single board. The Raspberry Pi 3 comes in with a 4× ARM Cortex-A53, 1.2GHz processor, 900 MHz 1GB LPDDR2 RAM and everything else other than a storage.

It has 4x USB ports to support external storage, which makes it highly versatile. RAM cannot be upgraded, though there are several versions with up to 4 GB of RAM. And it all starts from just $35, which makes it a very reasonable choice for starters. It also makes the entire process of making your own home server easier.

You might also like:

This is how to create your own server at home for web hosting

How to create your own server at home for web hosting

Learning how to create your own server at home for web hosting is actually simpler than you think. Everyone thinks there is a lot of coding involved in the complex process, which is inaccurate. With these instructions, it is fairly simple to create a web server at home. We will be covering both Windows and Linux server installations in this tutorial, so feel free to use either.

How to host a website in Apache server in Windows

  • Installing WAMP stack
  • Setting up MySQL and HTML files
  • Enabling public access for the website
  • Setting a domain name

1. Installing WAMP stack

You can install WAMPServer to get started on your journey on how to create your own server at home for web hosting. Your computer by default uses 80 for internet communication, and it may be in use by Skype or some other software. You can set Skype at port 443 from settings>tools>options.

When the installation is complete, a default directory (c:\wamp\www) will be available. You can create further subdirectories in it and add your HTML and PHP files there. Enter the localhost URL (http://localhost) and it will direct you to the WampServer dashboard.

2. Setting Up MySQL and HTML files

As a test, create a new PHP file by accessing the www directory from the WampServer. Name it Website Test and enter a simple HTML tagin it. You can also check out the settings and details of the PHP installation from http://localhost/info.php link. You can access the databases from the phpMyAdmin dashboard.

3. Enabling public access for the website

You will have to modify the default Apache server settings. They are configured to block incoming HTTP connections for security reasons. Access the httpd.conf file from the WampServer dashboard, select Apache and then the file itself. Over there, you will find the lines:

Order Deny,Allow
Deny from all

Change these lines to:

Order Allow,Deny
Allow from all

Restart the WampServer by selecting the “Restart all Services” option in the menu. This is important for the settings to take full effect.

If you need to set a static IP and configure port forwarding, that part is simple as well. Open command prompt from the Start Menu and enter ipconfig/all. This will give you the IP address, Subnet Mask, Default Gateway and DNS Server values.

Open Control Panel>Network and Internet>Network and Sharing Center>Change Adapter Settings>Local Area Connection and click properties. Select Internet Protocol Version 4 (TCP/IPv4) and click properties. Enter your new IP address in the “Default Gateway Number” field (for example, 192.168.1.23). Enter the other 3 values as they were. Then click OK.

Port forwarding is just as simple as knowing how to create a web server. Open the browser and enter your default gateway. Access the router interface by logging in and then select the “Applications & Gaming” option, then “Advanced” and then “Port Forwarding/Port Triggering”, “NAT/QoS” or anything resembling them. All routers will have the same basic layout from here onwards, requiring internal and external ports or Start and End ones. Select the Protocols and enter the static IP address that you previously created. If there is an option by the name of enable, be sure to check it.

4. Setting a domain name

We will start by modifying a few files. For instance, you have a domain by the name of hxxps://www.websitetest.com, with some files in the DNS with IP address at 192.168.1.23. We start by modifying the httpd.config file from the WampServer dashboard and add a virtual host. Look for these lines and uncomment it:

#Virtual hosts
Include conf/extra/httpd-vhosts.conf

Now you will manually create a file at the location: C:\wamp\bin\apache\Apache-version\conf\extra\ (version part will have your current Apache version). Open a text editor, such as Notepad and add the following lines in the document:

ServerAdmin [email protected]
DocumentRoot “c:\wamp\www”
ServerName mysite.local
ErrorLog “logs/websitetest.com.log”
CustomLog “logs/websitetest.com-access.log” common

Select the “Restart All Services” option from the WampServer dashboard and the changes will take effect. And now you know how to create your own server at home for web hosting on Windows.

How to make your own web hosting server Linux

  • Installing LAMP Stack
  • Testing PHP
  • Testing MySQL
  • Installing phpMyAdmin
  • DNS configuration
  • Apache server configuration

1. Installing LAMP stack

You will need to install LAMP stack to start building your web server. Enter the following command in the terminal:

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

Set a password for your MySQL root user. For changes to take effect on Apache, you will have to enter:

sudo /etc/init.d/apache2 restart

2. Testing PHP

Knowing how to make your own web hosting server on Linux necessitates testing it. Add a test PHP file to /var/www/html/, which is also the WebServer root directory. Name it “websitetest”. Next enter this into the directory:

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

Open the browser and enter http://localhost/websitetest.php. This should open the PHP file.

3. Testing MySQL

Enter:

sudo service mysql status

This should return running status. You can restart the service by entering:

sudo service mysql restart

Also ensure that the system and MySQL bind addresses are the same. Enter:

cat /etc/hosts | grep localhost

This will return several values, among which will be the IP address. Cross check it with the MYSQL configuration file to ensure they are the same. If they do not match, change them to match.

4. Installing phpMyAdmin

Enter:

sudo apt-get install phpMyAdmin

This will install phpMyAdmin. Click yes when it asks to create a default DB for exclusive use. Set the username and password and restart Apache server for changes to take effect. You can access phpMyAdmin from http://localhost/phpmyadmin/.

5. DNS configuration

You can set a personalized domain such as hxxp://www.websitetest.com. Change the Apache settings to allow external requests from the internet by modifying DNS settings. Ensure that the domain name has some record that directs towards an IP address. The DNS records are auto-updated by the service provider.

6. Apache server configuration

Enter:

sudo a2dissite *default

This will disable the Apache virtual host.

Enter:

cd /var/www/html

This will direct towards the default storage directory. Create a new folder for the website and change domain name by entering:

sudo mkdir websitetest.com

Create 4 sub-folders within the folder you just created. Enter the following commands to create weblogs, files and backups folders:

sudo mkdir -p websitetest.com/logs

sudo mkdir -p websitetest.com/public_html

sudo mkdir -p websitetest.com/backups

Enter the following command to launch a new virtual host file:

sudo nano /etc/apache2/sites-available/ sudo mkdir -p.com.conf

At this stage, the domain name will have a .conf at its end. Use the code provided below to create a configuration for the virtual host. Change the domain name “websitetest” with the one you want.


ServerAdmin [email protected]
Server_Name websitetest.com
Server_Alias www. websitetest.com
Directory_Index index.html index.php (folder for saved files)
Document_Root /var/www/html/ websitetest.com/public_html (has the html or php file names)
LogLevel warn
Custom_Log /var/www/html/ websitetest.com/log/access.log combined

Save the changes and enter:

sudo a2ensite websitetest.com.conf

This will prompt the restarting of the Apache server. Restart it for the changes to take effect. And now you know how to create your own server at home for web hosting on Linux.

How to create a web server: key takeaways

  • Learning how to create your own server at home for web hosting is not as complex as commonly thought.
  • Get the necessary hardware. Feel free to recycle old parts. If you are researching on how to create a web server for purely educational purposes, even decades old hardware will do.
  • Raspberry Pi is a really good option for most cases. You can stack servers for additional power.
  • Understanding how to make your own web hosting server on Linux and Windows is not that different. It follows the same steps, albeit with small differences.
  • Make sure your Internet Service Providers (ISPs) permit hosting activities.
  • Remember: you will be compromising on a lot of features that come with paid hosting. If your server gets popular, consider migrating to paid hosting services. They start from just $0.99 and can significantly streamline everything. However, you can go a long way with your own servers as well, as long as you maintain them properly.

FAQs

Setting up a home server is fairly simple. As long as you have the hardware, a stable internet connection and know the procedure, you can set it up and maintain it yourself. Before you set it up, check the rules of your ISP regarding your own server and follow the guidelines carefully.
The cost of building a server at home depends on the local price of components and whether you are reusing hardware. A simple Raspberry Pi can cost $35 while a high-end server to host thousands of concurrent users can cost $1,000. Don’t forget about the internet connection as well.
This is a common misconception. Servers are quite energy efficient, with several specialized builds that consume less than $10/month. For example, the power cost of a Raspberry Pi build is almost negligible, but more complex systems (especially server stacks) will need more electricity, thus adding to bills.
There are many variables; e.g., the power consumption of CPU, GPU, RAM, cooler, power costs, etc. Follow this formula: ((total power consumption/hr. x per unit cost) x 24 x 30) to calculate monthly bills. However, the average estimated cost is around $15 per month for a medium ranged server.
Depends on usage; e.g., your website will need about 10 MBPS connection to support good user experience for 100 concurrent users. For an e-commerce website, dedicate 5-10 MB RAM for every user, with 10% surplus for handling extra load. It is recommended to use an i-5, 5th generation processor.

Making a server (at home) costs you almost nothing if you are reusing old components. The cost is directly proportional to the hardware and web hosting costs. You can check out www.000webhost.com, infinityfree.net and sites.google.com to get an idea about it.

98Shares
Share or comment

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

98Shares

FREE Video Blogging Course

Learn how to build a successful blog

Learn how to...

  • Write the perfect blog post
  • Drive tons of free traffic
  • Design your blog like a pro
  • Get answers to all your blog questions