EDU BLOG

Mar 25, 2025

Create a tor website

Creating a website on the Tor network (also known as an onion service) requires a few key steps. Below is an overview of the process:


Step 1: Set Up a Linux Server

You need a VPS or dedicated server running Linux (Debian, Ubuntu, or CentOS recommended). You should also have root or sudo access.


Step 2: Install Tor

First, update your package list and install Tor:

1
sudo apt update && sudo apt install tor -y

Step 3: Configure Tor for an Onion Service

Edit the Tor configuration file:

1
sudo vi /etc/tor/torrc

Uncomment and modify these lines:

1
2
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:8080
  • The HiddenServiceDir is where Tor will generate your .onion address.
  • The HiddenServicePort maps the onion address to your web server.
  • 127.0.0.1:8080 means the website should run on port 8080 locally.

Save and exit .

Restart Tor to apply changes:

1
sudo systemctl restart tor

Now, find your .onion domain:

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

Step 4: Set Up a Web Server (Nginx or Apache)

Install a web server (Nginx recommended):

1
sudo apt install nginx -y

Edit the Nginx configuration file:

1
sudo vi /etc/nginx/sites-available/tor_site

Add this content:

1
2
3
4
5
6
7
8
9
10
11
server {
listen 127.0.0.1:8080;
server_name localhost;

root /var/www/tor_site;
index index.html;

location / {
try_files $uri $uri/ =404;
}
}

Save and exit, then enable the site:

1
2
sudo ln -s /etc/nginx/sites-available/tor_site /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Now, create an index.html file inside /var/www/tor_site/:

1
2
sudo mkdir -p /var/www/tor_site
echo "<h1>Welcome to My Tor Website</h1>" | sudo tee /var/www/tor_site/index.html

Set the correct permissions:

1
sudo chown -R www-data:www-data /var/www/tor_site

Step 5: Access Your Tor Website

Your .onion address (found in /var/lib/tor/hidden_service/hostname) is now live! Open Tor Browser and visit your new Tor website.


Other

Cheap VPS Recommendations Page:

OLDER > < NEWER