Host a Website
ZeroTier enables private networking between devices, allowing you to host a website locally and serve it securely to peers on the same ZeroTier network.
Prerequisites
- A working ZeroTier network with 2 or more devices, per the ZeroTier Quickstart Guide
Step 1: Run a Local Web Server
Choose your platform and follow the steps to start a simple web server:
- Windows
- MacOS
- Linux
This step requires Python. Some organizations rightfully restrict Python usage for security reasons. ZeroTier supports sharing any locally hosted server over a ZeroTier network, regardless of how it is being hosted (Python or not).
Open PowerShell in your website folder and start the built-in server (Python required):
python -m http.server 8080
Ensure Windows Firewall allows inbound traffic on port 8080
. To check, you can use Powershell in administrator mode:
netstat -a -n -o | findstr :8080
If you see an address LISTENIING
, a service is bound to it.
Open Terminal in your site directory and run:
python3 -m http.server 8080
If prompted, allow the connection through the firewall.
Open a terminal in your website folder. Then, use Python or any other HTTP server (e.g., NGINX, Apache):
python3 -m http.server 8080
Ensure ufw
or your firewall allows port 8080
:
sudo ufw allow 8080
Step 2: Access the Website
On another device in your ZeroTier network:
- Open a browser.
- Navigate to:
http://<ZeroTier IP of host>:8080
Next Steps
By default, Python searches for a file index.html
in the directory you are running the website from to act as a homepage. To customize your site, create and modify this file. Find out more about Python HTTP Servers.
Other options for self-hosted HTTP sites include:
- Apache HTTP (
sudo apt install apache2
) - Nginx (
sudo apt install nginx
) - Node.js-based servers
Just configure them to listen on your ZeroTier IP or all interfaces (0.0.0.0
).