A step-by-step interactive guide to hosting your website from your living room using Apache on Linux
A server is just a computer that provides a service to other computers. Your home server will run a program called Apache that listens for requests and sends back your website files. It is not special hardware — it is a normal computer running server software.
Your server needs a consistent local IP address so your router always knows where to send traffic. We also update the system so we install current, secure software.
Open a terminal on your Linux machine and run:
inet line under your network adapter (usually eth0 for wired, wlan0 for wireless)192.168.1.50 or 192.168.0.45apt update refreshes the list of available softwareapt upgrade installs the latest versions-y automatically answers "yes" to promptsIf sudo asks for a password, type your user password (characters won't show on screen). If you get "command not found," make sure you are on a Debian/Ubuntu-based system. For other Linux distributions, the package manager will be different (e.g., dnf for Fedora).
Apache HTTP Server is a program that runs in the background, listens for incoming requests on port 80, finds the right file on your computer, and sends it back to the visitor's browser. It is one of the most widely used web servers in the world.
systemctl is the command Linux uses to manage background servicessudo systemctl start apache2curl is a command-line tool that fetches web pagesApache's default web root (the folder it looks in for files) is /var/www/html/. When someone visits your site, Apache looks for index.html in that folder and sends it.
nano is a simple text editor inside the terminal/var/www/html/ is a system folder, you need sudo to write to itCtrl+O to save (then press Enter to confirm)Ctrl+X to exit nanoOn your phone or another computer connected to the same network, open a browser and go to:
(Replace with your actual local IP from Step 1)
Your other device asked your Linux machine for a web page. Apache received the request, found index.html, and sent it back. This works only inside your home right now. The internet cannot reach it yet.
Your Linux machine has a built-in gatekeeper called UFW (Uncomplicated Firewall). By default, it may block incoming requests. We need to tell it: "Allow web traffic on ports 80 and 443."
Status: inactive, the firewall is not running. You can skip to the next step, but enabling it is recommended.Status: active, continue below.'Apache Full' is a pre-built profile that opens both port 80 (HTTP) and port 443 (HTTPS)y and press Enter when it warns you about disrupting connectionsYou should see rules for Apache Full, and possibly SSH.
You have a local IP (like 192.168.1.50) that only works inside your house. Your router has a public IP that the entire internet sees. When someone visits your site from another city, they use your public IP.
203.0.113.45Most home internet plans give you a dynamic IP — it changes periodically. That is why we will set up Dynamic DNS in Step 7. But for now, we just need to know what it is today.
Your router is the gatekeeper. It has one public IP, but many devices inside your home. When a request from the internet arrives on port 80, the router needs a rule that says: "Send this to the Linux server at 192.168.1.50." Without this rule, the request dies at the router.
http://192.168.1.1 or http://192.168.0.1Look for one of these names in your router menu:
| Name | External Port | Internal IP | Internal Port | Protocol |
|---|---|---|---|---|
| Apache-HTTP | 80 | 192.168.1.50 | 80 | TCP |
| Apache-HTTPS | 443 | 192.168.1.50 | 443 | TCP |
Replace 192.168.1.50 with your actual local IP from Step 1.
Use your phone with Wi-Fi turned OFF (use cellular data) or ask a friend:
Replace with your actual public IP from Step 5.
Internet → Public IP → Router → Port Forward → Linux → Apache → Your File. Every link works.
Your public IP changes. If you give someone your IP today, it might be wrong tomorrow. Dynamic DNS gives you a free domain name (like yourname.duckdns.org) that automatically updates to point to your current IP.
yourname.duckdns.orgType this inside nano (replace YOURNAME and YOUR_TOKEN):
Ctrl+O, then Enter, then Ctrl+Xchmod 700 makes the script runnable by only you./duck.sh runs itcat duck.log shows the result — it should say OKnano (option 1)Ctrl+O, Enter, Ctrl+XWait 2–3 minutes, then visit:
Replace with your actual DuckDNS subdomain.
| Port 80 — HTTP | Port 443 — HTTPS | |
|---|---|---|
| Security | Unencrypted | Encrypted (TLS/SSL) |
| Data | Readable by anyone intercepting | Private between browser & server |
| Browser | No padlock | Shows padlock icon |
| Required for | Testing only | Logins, payments, SEO, production |
certbot is the tool that gets free certificates from Let's Encryptpython3-certbot-apache is the plugin that configures Apache automaticallyyourname.duckdns.org with your actual DuckDNS domainVisit your site with https://:
You now have a complete web server running from your living room. Here is what you built:
ip addr show — Find local IP
curl ifconfig.me — Find public IP
sudo systemctl status apache2 — Check Apache
sudo systemctl restart apache2 — Restart Apache
sudo ufw status — Check firewall
sudo certbot renew --dry-run — Test SSL renewal
/var/www/html/ — Website files
/etc/apache2/ — Apache config
/etc/apache2/sites-available/ — Virtual hosts
~/duckdns/duck.sh — DNS updater
80 — HTTP (unencrypted)
443 — HTTPS (encrypted)
22 — SSH (local only)
Your server is yours. You control the hardware, the software, and the content.