Tor Project

Tor Website on Ubuntu

This is a quick tutorial on how to set up a Tor website using Nginx on Ubuntu.

Step 1: Install Nginx

Type: sudo apt install nginx

Type: sudo nano /etc/nginx/sites-available/default

Replace the entire contents of the file with the code block below.

server {
       listen default_server;
       server_name localhost;
       root /usr/share/nginx/html;
       index index.html index.htm;
       location / {
               deny all;

Step 2: Install Tor

Typelsb_release -a

Note down your Linux release version and codename.

Then visit this link and select your Linux version and codename from the drop down menu.

Follow the instructions on that page, then continue back here.

Type: sudo nano /etc/tor/torrc

Look for the following two lines of code and uncomment them, then change “” to “”.

#HiddenServiceDir /var/lib/tor/hidden_service/ 
#HiddenServicePort 80

After making those changes, the two lines should now look like this:

HiddenServiceDir /var/lib/tor/hidden_service/ 
HiddenServicePort 80

Step 3: Restart the Services

Type: sudo service nginx restart

Typesudo service tor restart

Step 4: Test Your Tor Website

Typesudo nano /var/lib/tor/hidden_service/hostname

Copy your .onion hostname and try it out in your Tor Browser.

Your websites html files can be found in /usr/share/nginx/html

As a final note, I strongly advise you to read Tor Hidden (Onion) Services Best Practices.