Post

Setting up a Tor Server

Setting up a Tor Server

Tor (The Onion Router) is a network that enables anonymous communication. This guide will walk you through setting up a Tor server with Nginx on a Debian system, including how to customize the default web page.

Update Your System

First, ensure your system is up to date:

1
sudo apt update && sudo apt upgrade -y

Install Tor and Nginx

Install Tor and Nginx using the following command:

1
sudo apt install tor nginx -y

Then enable and start both Tor and Nginx

1
2
3
4
sudo systemctl enable nginx
sudo systemctl enable tor
sudo systemctl start nginx
sudo systemctl start tor

Configure Tor

Now edit the Tor configuration file:

1
sudo nano /etc/tor/torrc

Uncomment or add the following lines at the end of the file:

1
2
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80

Save and exit the file (Ctrl+X, then Y, then Enter).

Restart Tor Service

Restart the Tor service to apply the changes:

1
sudo systemctl restart tor

Get Your .onion Address

Your .onion address is now generated. You can find it by running:

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

You will have a domain name like below

1
qd4axpacwmfx7zg7abdssxrhmikrg66gsgamxd6vr4ms2fmdzvjqq2yd.onion

Make note of this address, as it’s how users will access your hidden service. Enter this address to the tor browser and you will get the default webpage of nginx

Desktop View

Customize Your Website

You have two options to quickly customize your website:

Edit the default index.html

Replace the default index.html with your desired content:

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

Add your custom HTML content. For example:

1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Tor Hidden Service</title>
</head>
<body>
    <h1>Welcome to My Tor Hidden Service</h1>
    <p>This is a custom web page served over the Tor network.</p>
</body>
</html>

Download a static page from GitHub

Alternatively, you can download a pre-made static website from a GitHub repository:

First, remove the existing content in the /var/www/html directory:

1
 sudo rm -rf /var/www/html/*

Then, clone the desired GitHub repository into the /var/www/html directory:

1
sudo git clone https://github.com/rzlwbo1/ViolaOnlineStore /var/www/html/

Now, when you access your Tor hidden service, you’ll see the downloaded page instead of the default Nginx page.

Desktop View

This post is licensed under CC BY 4.0 by the author.

Trending Tags