Published on

How to Create a Website on the Tor Network

cover

The Tor network enables the creation and hosting of anonymous websites, commonly referred to as hidden services or .onion sites. This is particularly useful for safeguarding user privacy and anonymity. In this guide, you will learn how to set up a website on the Tor network step by step.

1. Installing Tor

First, install Tor on your server:

sudo apt update
sudo apt install -y tor

Start the Tor service

Ensure that the Tor service is running:

sudo systemctl start tor

Verify if the Tor service is active

service --status-all | grep "\[ + \]"

2. Configuring a Hidden Service

Edit the Tor configuration file to enable a hidden service:

sudo nano /etc/tor/torrc

Add or update the following lines at the end of the file:

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:8000
  • HiddenServiceDir: Specifies the directory where the hidden service keys and .onion address will be generated.
  • HiddenServicePort: Maps port 80 on the Tor network (public access) to port 8000 on your local server.

Save the file and restart the Tor service:

sudo systemctl restart tor

3. Retrieving Your .onion Address

After restarting Tor, retrieve your generated .onion address:

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

The output will look something like this:

example1234.onion

This is your website's address on the Tor network.


4. Setting Up a Web Server

You will need a web server (e.g., Apache or Nginx) to host your website. Alternatively, you can use Python’s built-in HTTP server for testing purposes.

kali

Start the server:

sudo systemctl start apache2
sudo systemctl enable apache2

5. Adding Website Content

Place your website content in the default Apache directory:

sudo nano /var/www/html/index.html

Add your HTML content:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hidden Network</title>
</head>
<body>
    <center>
        <h1>
            I'm on the hidden network of the internet 😈
        </h1>
    </center>
</body>
</html>

Save the file and confirm that the website is functioning by accessing your .onion address through the Tor browser.


6. Testing Your Hidden Service

  1. Download the Tor browser from torproject.org.
  2. Open the Tor browser and enter your .onion address in the address bar.
  3. Your website should load successfully.
tor