India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

How to Make Your Own Web Hosting Server from Scratch

We are Hiring!

We are looking for an experienced SEO writer and copywriter to join us at Cloudoon

Hosting your own website at home can save you money in Kenya, where shared hosting costs about 2,500 KES per year. 

It is easier than many people think, and you do not need to be an expert just the right steps and tools. 

A home server stores your website files on your computer and sends pages to visitors, giving you more control and lower costs for small sites. 

However, power cuts and changing IP addresses from providers like Safaricom and Zuku can cause problems. 

This guide shows you how to set up your own web hosting server, protect it, choose the right hardware.

It also helps know when it is better to switch to a provider like Truehost, which offers plans from 999 KES per year with M-PESA payments.

Step 1: The Basics and Check Requirements

Your home web hosting server is like a house for your website. 

It stores all your files, images, text, and code, and sends them to visitors when they type your website address. 

For a small website with about 50 visitors per day, a home server works well. 

own web hosting server

Before starting, check your internet connection. You need at least 5 Mbps upload speed. You can test it on Speedtest.net.

Most Kenyan ISPs, like Safaricom and Zuku, give dynamic IP addresses that change often. 

To solve this, use a free Dynamic DNS service like No-IP. It keeps your website reachable even if your IP changes.

You also need to set up port forwarding on your router. This lets internet traffic reach your server. 

Log in to your Safaricom or Zuku router (usually at 192.168.1.1), find WAN settings, and open ports 80 for HTTP and 443 for HTTPS.

ItemPurposeCost (KES)
Internet TestEnsure fast website loadingFree
UPSKeeps server on during outages5,000
Startup BudgetCovers basic hardware10,000 min

Step 2: Choose and Assemble Your Hardware

The hardware is the foundation of your home server. Choose parts that can run 24/7 without overheating. 

You can start with a mini-PC or an old laptop for testing.

own web hosting server

For a small website with up to 100 visitors at the same time, you need:

  • CPU: Intel i5 (4th generation or better) handles multiple users easily
  • RAM: 8GB – keeps everything smooth
  • Storage: 500GB SSD – fast access to files
  • Network: Gigabit Ethernet cable is better than Wi-Fi for stable connection

If your website grows later, you can add RAID for backup and extra storage. You can also repurpose an old PC to save money.

ComponentRecommendationApprox. Price (KES)
CPUIntel i5 4th Gen12,000
RAM8GB DDR42,500
SSD500GB NVMe3,000
Case/PSUBasic tower5,000

Step 3: Select and Install Your Operating System

The operating system (OS) is what makes your server work. For a home web server, Linux is the best choice. 

own web hosting server

It is free, secure, and powers most websites around the world. Windows costs extra and attracts more viruses, so it is not recommended for beginners.

We suggest Ubuntu Server. It is beginner-friendly and has many guides and communities, including in Kenya.

Steps to Install Ubuntu:

  1. Download Ubuntu Server from ubuntu.com.
  2. Create a bootable USB using Rufus (free tool).
  3. Boot from USB: Restart your PC, enter BIOS (press F2), and set the USB drive as the first boot device.
  4. Partition your disk:
    • 100GB for root (/)
    • The rest for home (/home)
  5. Set up your user account and a strong password.
  6. Update the system:
    sudo apt update && sudo apt upgrade
  7. Reboot your server.

Ubuntu handles Safaricom and Zuku’s variable internet speeds well. If you face issues, check local forums or Reddit communities for help.

Why Ubuntu over CentOS or Windows?

  • Easier to update and maintain
  • Beginner-friendly
  • Free, no extra licenses needed

Now your server has a solid base OS and is ready for further setup.

Step 4: Set Up and Configure Your Home Server Environment

Now that your server has Ubuntu installed, it is time to connect it to your network and prepare it for hosting websites.

own web hosting server

1) Connect to the Network

Always use an Ethernet cable instead of Wi-Fi. Wired connections are more stable and do not drop often.

2) Assign a Static IP

Dynamic IPs from Safaricom or Zuku can change. To avoid interruptions, set a static IP:

Open the netplan file:

sudo nano /etc/netplan/01-netcfg.yaml

Set your server IP (e.g., 192.168.1.100)

Apply changes:

sudo netplan apply

3) Access Remotely

You can control the server from another PC using SSH:

ssh username@192.168.1.100

If SSH is not installed, run:

sudo apt install openssh-server

For a visual interface, install VNC:

sudo apt install tightvncserver

Set a password and connect using the RealVNC app.

4) Set Up a Firewall

Enable Ubuntu’s firewall (UFW) to secure your server:

sudo ufw enable

sudo ufw allow 22

This allows SSH access while blocking other unwanted traffic.

5) Install Monitoring Tools

Install htop to watch CPU and RAM usage:

sudo apt install htop

Test your setup by SSHing from your phone hotspot. This ensures you can manage the server from anywhere in Kenya.

Step 5: Install Core Web Hosting Software

Now your server is ready to host websites. You need a web server, database, and PHP to make dynamic sites like WordPress work.

own web hosting server

1) Install Nginx (Web Server)

Nginx is faster and easier than Apache for beginners. It serves your website pages.

Install Nginx:

sudo apt install nginx

Start Nginx:

sudo systemctl start nginx

  • Test it: Open your server’s IP in a browser. You should see the Nginx welcome page.

2) Install FTP for File Transfers

FTP lets you upload files to the server. Install vsftpd:

sudo apt install vsftpd

Edit the configuration file /etc/vsftpd.conf to allow uploads:

local_enable=YES

write_enable=YES

Restart vsftpd:

sudo systemctl restart vsftpd

Use FileZilla on your computer to upload website files.

3) Install Database and PHP

Dynamic websites like WordPress need a database. Install MySQL and PHP:

sudo apt install mysql-server php-fpm php-mysql

  • Secure MySQL:

sudo mysql_secure_installation

  • Connect PHP with Nginx by editing /etc/nginx/sites-available/default and adding the PHP handler.

4) Test PHP

Create a simple test file:

sudo nano /var/www/html/index.php

Add:

<?php phpinfo(); ?>

Reload Nginx and open your IP in a browser. You should see PHP info.

5) Upload a Test Website

Use FTP to upload a simple HTML page. Open it in your browser to make sure it works.

SoftwareCommandPurpose
Nginxsudo apt install nginxServe web pages
vsftpdsudo apt install vsftpdUpload and download files
MySQL + PHPsudo apt install mysql-server phpRun dynamic websites

This setup can handle blogs or small business sites easily. For bigger traffic, you may later move to Truehost SSD-powered plans.

Step 6: Configure DNS and Domain Setup

A domain makes your website easy to find. Without it, visitors need your IP address, which is hard to remember.

own web hosting server

1) Buy a Domain

In Kenya, you can get a .co.ke domain from KeNIC or Truehost for about 1,000 KES per year.

2) Point Domain to Your Server

  • Find your public IP at whatismyip.com.
  • In your domain registrar’s panel, set the A record to your IP.

Example:

@ IN A your.public.ip

www IN CNAME @

3) Install a DNS Server (Optional)

For full control, you can run your own DNS using BIND:

sudo apt install bind9

Create a zone file:

sudo nano /etc/bind/db.example.co.ke

Add your IP and server name as above. Restart BIND:

sudo systemctl restart bind9

4) Handle Dynamic IPs

Most Kenyan ISPs give dynamic IPs that change. To fix this, use No-IP:

sudo apt install ddclient

Configure it with your No-IP account to update your IP automatically.

5) Test Your Domain

  • Use tools like DNSChecker.org to see if your domain points correctly.
  • Full propagation can take up to 48 hours.

Step 7: Secure Your Server

A server connected to the internet can be attacked by hackers. Security is very important.

1) Change SSH Settings

  • By default, SSH uses port 22. Hackers often scan this port. Change it to 2222:

sudo nano /etc/ssh/sshd_config

  • Disable root login:

PermitRootLogin no

  • Use SSH keys for login instead of passwords:

ssh-keygen

ssh-copy-id user@server

2) Set Up Firewall

Ubuntu has UFW firewall. Allow only necessary ports:

sudo ufw allow 22,443,80/tcp

sudo ufw enable

This blocks unwanted access.

3) Install SSL for HTTPS

Secure your website with HTTPS using Certbot:

sudo apt install certbot python3-certbot-nginx

sudo certbot –nginx

This automatically sets up a free SSL certificate.

4) Protect Against DDoS and Hacks

  • Use Cloudflare free plan to hide your IP.
  • Install fail2ban to block repeated login attempts:

sudo apt install fail2ban

  • Sanitize PHP inputs to prevent injections.

5) Keep Your Server Updated

Run updates weekly:

sudo apt update && sudo apt upgrade

6) Test Security

Use nmap from another device to scan open ports and check if only allowed ports are open.

After these steps, your home server is much safer. It is now ready to host websites without easy risk from hackers.

Step 8: Create and Manage Hosting Accounts

If you want to host multiple websites on your server, you need virtual hosts and separate user accounts. This keeps each site organized and secure.

1) Set Up Virtual Hosts in Nginx

  • Create a configuration file for each site:

sudo nano /etc/nginx/sites-available/site1

  • Add this server block:

server {

    listen 80;

    server_name site1.co.ke;

    root /var/www/site1;

}

  • Enable the site:

sudo ln -s /etc/nginx/sites-available/site1 /etc/nginx/sites-enabled/

sudo nginx -t

sudo systemctl reload nginx

2) Create Users for Each Site

  • Add a new user:

sudo adduser client1

  • Assign their website folder:

sudo chown -R client1:client1 /var/www/site1

  • You can also set disk quotas to limit usage.

3) Use a Control Panel (Optional)

  • Install Webmin for an easy web interface to manage users, websites, and emails.

wget http://www.webmin.com/download/…

Follow the official guide to install.

4) Email Management

If needed, install Postfix to forward emails for each domain.

5) Scale Your Server

You can manage multiple small websites this way. If you want more than 5–10 sites, consider Truehost multi-domain hosting, starting at 2,500 KES per year.

Step 9: Optimize Performance and Scalability

A slow website loses visitors. Optimizing your server makes it faster and ready for more users.

own web hosting server

1) Add Caching

Caching stores frequently used data so your server doesn’t have to reload it every time. Install Redis:

sudo apt install redis-server

2) Optimize Nginx

Enable Gzip compression in Nginx to reduce file sizes by about 70%. This makes pages load faster.

3) Monitor Resources

Use htop to see CPU and RAM usage in real-time:

htop

For uptime monitoring, sign up on UptimeRobot. It sends alerts if your server goes offline.

4) Load Testing

Test your server’s limits using Apache Bench:

ab -n 100 -c 10 http://yoursite.co.ke/

  • -n 100 = total requests
  • -c 10 = concurrent users

5) Plan for Growth

  • Add RAID SSDs for backup and redundancy.
  • Hybrid option: Mirror your site to a Truehost VPS for higher uptime (around 10,000 KES/year).
  • Keep server temperature under 60°C using fans in hot areas of Kenya.
ToolPurposeFree?
RedisCache dataYes
htopMonitor CPU/RAMYes
UptimeRobotAlerts for downtimeYes

Step 10: Implement Backups and Monitoring

Backups protect your website and data. Monitoring helps you know when something goes wrong. Both are important for keeping your server safe and running well.

1) Set Up Automatic Backups

You should back up your website and database often. This protects your work if something breaks.

Backup Website Files

Use the tar command:

tar -czf /backups/site1.tar.gz /var/www/site1

Backup MySQL Database

Use this command:

mysqldump -u root -p site1 > /backups/site1.sql

Automate Backups With Cron

Set your server to back up files every day:

crontab -e

Add this line:

0 2 * * * tar -czf /backups/site1.tar.gz /var/www/site1

This runs at 2:00 AM every day.

2) Store Backups Safely

Never keep backups only on the same server. A good backup plan uses three locations:

  • The server
  • A local computer
  • The cloud (Google Drive, Dropbox, or Truehost Backup Storage)

Cloud storage is safer because it stays online even if your server fails.

3) Use Monitoring Tools

Monitoring helps you check if your server is healthy.

Install Netdata

Netdata shows real-time charts of CPU, RAM, and traffic.

bash <(curl -Ss https://my-netdata.io/kickstart.sh)

Use UptimeRobot

  • It checks your server every 5 minutes.
  • It sends you an email or SMS if your server goes offline.
  • Free to use.

4) Set Alerts for Disk Space

If your server storage gets full, websites will stop working. Set an alert:

df -h

You can create a cron job to email you when storage is above 80%.

5) Test Your Backup

A backup is useless if it does not work.
Every month, restore your backup on a test computer or a test folder to make sure everything works.

Step 11: Security Best Practices

Security is very important when you own a server. You must protect your server from hackers, viruses, and bad traffic. Follow these simple steps to keep your server safe.

own web hosting server

1) Keep Your Server Updated

New updates fix security problems.
Run this command often:

sudo apt update && sudo apt upgrade -y

2) Use Strong Passwords

A weak password is easy to guess.
Make sure your passwords:

  • Have at least 12 characters
  • Use numbers
  • Use symbols
  • Use uppercase and lowercase letters

Example:
Nairobi@Server2024!

3) Install a Firewall (UFW)

A firewall blocks dangerous traffic.

Run these commands:

sudo apt install ufw

sudo ufw allow OpenSSH

sudo ufw enable

sudo ufw status

This keeps SSH open but blocks bad connections.

4) Disable Root Login

Hackers always try to enter as “root.”
Disabling root makes your server safer.

Edit SSH config:

sudo nano /etc/ssh/sshd_config

Find:

PermitRootLogin yes

Change to:

PermitRootLogin no

Restart SSH:

sudo systemctl restart ssh

5) Install Fail2Ban

Fail2Ban blocks users who try many wrong passwords.

Install it:

sudo apt install fail2ban

Start it:

sudo systemctl start fail2ban

Now your server blocks attackers automatically.

6) Enable HTTPS (SSL Certificate)

SSL makes your website secure.

Install Certbot:

sudo apt install certbot python3-certbot-nginx

Add SSL:

sudo certbot –nginx

Your website will now show a padlock icon.

7) Limit SSH Access

Only allow SSH from your IP if possible.

Example:

sudo ufw allow from 197.xx.xx.xx to any port 22

This blocks everyone else.

8) Scan for Malware

Use ClamAV to scan for viruses:

sudo apt install clamav

clamscan -r /var/www

9) Regular Security Checks

Do these checks once a month:

  • Check firewall rules
  • Check logs for unusual activity
  • Check for failed login attempts
  • Update all software

Step 12: Final Recommendations

a) Start with your own web hosting server if you want to learn

It’s great for practice and small websites.

b) Move to Truehost when you need stability

If your site gets more than 500+ daily visitors, upgrade to:

  • Shared Hosting (Starter Plan) – 2,500 KES/year
  • Cloud VPS – 1,200 KES/month

c) Always keep backups

Store backups in 3 places:

  • Your laptop
  • Cloud storage
  • A USB drive or external disk

d) Monitor your server weekly

Check:

  • Disk space
  • Security logs
  • CPU and RAM usage
  • Website uptime

This keeps your hosting safe and smooth.

SSL COUPON Offer

Read More Posts

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Free Web Hosting and Domain Name with cPanel: Is It Worth It?

Starting a website can feel overwhelming. You want to get online quickly, but the costs, technical setup, and…

Web Hosting Basics: Everything You Need to Know Before You Start

Web Hosting Basics: Everything You Need to Know Before You Start

When starting a website for any purpose, we encounter various terms, such as web hosting. You might have…

Free Web Hosting for Developers and Test Projects

Free Web Hosting for Developers and Test Projects

Are you a developer looking for free web hosting for developers that actually works for real projects? You’re…

Free Web Hosting Without Credit Card Requirements

Free Web Hosting Without Credit Card Requirements

Starting an online project should be exciting, not complicated by payment details.  Are you looking to launch a…