How to Set Up a .onion Site
Setting up a Tor hidden service (now called 'onion service') makes your website accessible via a .onion address on the Tor network. This tutorial walks you through the technical setup — from installing Tor to configuring your web server and generating your v3 onion address.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Prerequisites
- A Linux server (Ubuntu/Debian recommended) — can be a VPS or dedicated server
- A web server (Nginx or Apache) running your site
- Root or sudo access
- Basic command-line knowledge
For maximum privacy, use a server from an offshore hosting provider that accepts cryptocurrency and doesn't require identity verification.
Step 1: Install Tor
On Ubuntu/Debian:
sudo apt update
sudo apt install torAdd the official Tor Project repository for the latest version:
# Add Tor Project repo
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org $(lsb_release -cs) main" >> /etc/apt/sources.list.d/tor.list'
sudo apt update && sudo apt install torStep 2: Configure the Hidden Service
Edit the Tor configuration file:
sudo nano /etc/tor/torrcAdd these lines:
HiddenServiceDir /var/lib/tor/my-onion-site/
HiddenServicePort 80 127.0.0.1:80This tells Tor to:
- Store the onion service keys in
/var/lib/tor/my-onion-site/ - Forward traffic from the .onion port 80 to your local web server on port 80
For HTTPS onion services, add: HiddenServicePort 443 127.0.0.1:443
Step 3: Start Tor and Get Your .onion Address
sudo systemctl restart tor
sudo cat /var/lib/tor/my-onion-site/hostnameThis outputs your v3 .onion address (56 characters + .onion). This is your permanent address — it won't change unless you delete the key files.
Backup your keys! The files in /var/lib/tor/my-onion-site/ contain your private key. If you lose them, you lose your .onion address forever.
Step 4: Configure Your Web Server
Configure Nginx to listen only on localhost (your onion service forwards to 127.0.0.1):
server {
listen 127.0.0.1:80;
server_name localhost;
root /var/www/my-onion-site;
index index.html;
}Security tips:
- Don't include your clearnet domain in the config — it leaks your identity
- Remove server version headers:
server_tokens off; - Don't log access:
access_log off;
Skip the Setup — Use AnubizHost
Setting up Tor hidden services correctly requires careful security configuration. One mistake can leak your server's real IP address.
AnubizHost handles all of this for you:
- Pre-configured Tor hidden services with v3 onion addresses
- Secure server configuration that prevents IP leaks
- DDoS protection for .onion services
- Automatic Tor updates and security patches
- Offshore servers with no KYC — pay with crypto
Deploy your .onion site in minutes, not hours.
Related Services
Why Anubiz Labs
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.