Tor Project - Hidden Service

Create a Tor Website on Ubuntu

This article will show you how to create a Tor Hidden Service website on Ubuntu Linux.

This is in no way an exhaustive set up procedure and we highly encourage you to read Tor best practices. With that said though, if you follow the instructions below, by the end of this article you will have yourself a fully working Hidden Service website on the Tor network.

Throughout this article I use apt in place of apt-get . It should work with Ubuntu, if not use apt-get in place of apt

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.

Save and exit by pressing CTRL+X , Y and ENTER.

Install Tor:

Type: lsb_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.

When you choose your version from the “I run” drop down menu you should notice the lines starting with deb change to include the codename of your Linux version. It’s important to select the correct version before proceeding to the next step.

Highlight and copy the entire line starting with deb, like this:

deb xenial main

Type: sudo nano /etc/apt/sources.list

Paste the line of text you just copied from that web page at the bottom of “sources.list”.

Save and exit by pressing CTRL+X , Y and Enter.

Type: gpg –keyserver –recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
Type: gpg –export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add –
Type: sudo apt update
Type: sudo apt install tor
Type: sudo nano /etc/tor/torrc

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

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

Save the file by pressing CTRL+X, Y then ENTER.

Type: sudo service nginx restart
Type: sudo service tor restart
Type: sudo 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.