Hosting your own ONION site

Hosting your own .onion site on the Tor network is a powerful way to offer anonymous, censorship-resistant content. Here’s a detailed step-by-step guide to setting up a hidden service (a .onion site) using Tor on a Linux system like Ubuntu. This guide assumes you’re using a VPS or local server.


🌐 What is a .onion Site?

A .onion address is a website hosted as a Tor hidden service. Only accessible via the Tor browser, it hides both the identity of the host and the user, offering strong anonymity.


✅ Prerequisites

  • A server (local or remote with SSH access).

  • A domain name isn’t needed; the Tor network provides the .onion address.

  • A basic web server (like Apache or Nginx).

  • Tor installed.


📦 Step 1: Install Tor

Install Tor from your system’s package manager:

bash
sudo apt update
sudo apt install tor

Check it’s running:

bash
sudo systemctl status tor

🛠️ Step 2: Set Up a Web Server

Install a basic web server, like Apache:

bash
sudo apt install apache2

Put your HTML content in /var/www/html/index.html.

Test by visiting http://localhost or your server’s IP — you should see your webpage.


🔐 Step 3: Configure the Hidden Service

Edit the Tor config file:

bash
sudo nano /etc/tor/torrc

Add the following at the end:

bash
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80

Explanation:

  • HiddenServiceDir is where Tor stores keys and your .onion address.

  • HiddenServicePort maps port 80 of the hidden service to localhost’s port 80 (your web server).

Save and exit, then restart Tor:

bash
sudo systemctl restart tor

🔍 Step 4: Get Your .onion Address

After restarting Tor, run:

bash
sudo cat /var/lib/tor/hidden_service/hostname

You’ll see something like:

duskduskduski4tw.onion

That’s your new .onion domain!


🔒 Step 5: Secure the Setup (Optional but Recommended)

  • Use a firewall to only allow connections on port 22 (SSH) and 80 (HTTP).

  • Keep Tor and Apache updated.

  • Consider using HTTPS inside Tor (yes, even on .onion) with a self-signed cert or Let’s Encrypt (if reachable).


🧪 Step 6: Test in Tor Browser

Open the Tor Browser and visit your .onion URL.

You should see your website!


🚀 Advanced Tips

  • You can host multiple .onion services by duplicating the HiddenService* lines with different ports/directories.

  • To rotate your onion address, delete /var/lib/tor/hidden_service/ and restart Tor — but you’ll lose the old address.

  • For persistent identity, back up the private key in that directory (private_key file).


⚠️ Legal & Ethical Note

Running a .onion site is legal in most countries if used for legal purposes. Always check local laws and avoid hosting anything illegal or malicious.

Leave a Reply

Your email address will not be published. Required fields are marked *

2025 Onion Observer

Exploring the darknet. Onion Observer serves guides about privacy, security and cryptocoins and about the TOR network and how to access the hidden services. Sometimes we write about drugs and marketplaces too.