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.

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.
| Item | Purpose | Cost (KES) |
| Internet Test | Ensure fast website loading | Free |
| UPS | Keeps server on during outages | 5,000 |
| Startup Budget | Covers basic hardware | 10,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.

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.
| Component | Recommendation | Approx. Price (KES) |
| CPU | Intel i5 4th Gen | 12,000 |
| RAM | 8GB DDR4 | 2,500 |
| SSD | 500GB NVMe | 3,000 |
| Case/PSU | Basic tower | 5,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.

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:
- Download Ubuntu Server from ubuntu.com.
- Create a bootable USB using Rufus (free tool).
- Boot from USB: Restart your PC, enter BIOS (press F2), and set the USB drive as the first boot device.
- Partition your disk:
- 100GB for root (/)
- The rest for home (/home)
- 100GB for root (/)
- Set up your user account and a strong password.
- Update the system:
sudo apt update && sudo apt upgrade - 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.

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.

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.
| Software | Command | Purpose |
| Nginx | sudo apt install nginx | Serve web pages |
| vsftpd | sudo apt install vsftpd | Upload and download files |
| MySQL + PHP | sudo apt install mysql-server php | Run 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.

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.

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.
| Tool | Purpose | Free? |
| Redis | Cache data | Yes |
| htop | Monitor CPU/RAM | Yes |
| UptimeRobot | Alerts for downtime | Yes |
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.

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.
Domain SearchInstantly check and register your preferred domain name
Web Hosting
cPanel HostingHosting powered by cPanel (Most user friendly)
KE Domains
Reseller HostingStart your own hosting business without tech hustles
Windows HostingOptimized for Windows-based applications and sites.
Free Domain
Affiliate ProgramEarn commissions by referring customers to our platforms
Free HostingTest our SSD Hosting for free, for life (1GB storage)
Domain TransferMove your domain to us with zero downtime and full control
All DomainsBrowse and register domain extensions from around the world
.Com Domain
WhoisLook up domain ownership, expiry dates, and registrar information
VPS Hosting
Managed VPSNon techy? Opt for fully managed VPS server
Dedicated ServersEnjoy unmatched power and control with your own physical server.
SupportOur support guides cover everything you need to know about our services








