Creating a Dark Web Tor Onion Service/Website
This is a quick guide on how to create a Tor Onion Service. In fact, I have created a Tor Onion Service for this blog. You can access it at http://charlie2bm2qrzthb4a6ew6u5y4vghjcqj4jv6n26knrjlzb5xd7zfid.onion/
using the Tor Browser or any other Tor compatible browser.
First of all, I want to stress that although lots of illegal activity can (and does) occur on the dark web, not all dark web activity is illegal. For example, DuckDuckGo has a Tor Onion Service at: https://duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad.onion/
. Providing privacy and anonymity to users is a legitimate use of the dark web. Please do not use dark web for illegal purposes.
Step 0: Create vanity address (optional)
You might be wondering how I got a .onion URL that begins with charlie
. This was done using a tool called mkp224o. I installed on one of my home servers using Homebrew:
brew install mkp224o
Then I ran the following command:
mkp224o charlie -t 7 -v -d ~/Tor
The charlie
specifies the prefix of the .onion address. The -t 7
specifies that I want to use 7 CPU threads. The -v
specifies that I want verbose output. The -d ~/Tor
specifies that I want to save the keys in the ~/Tor
directory that will be created for you.
After letting it run overnight I had a bunch of vanity addresses I could choose from. I chose the one that I liked the most and used it for my Tor Onion Service.
It's important to note that this step is optional. You can skip this step and just use the default .onion address that Tor generates for you.
Additionally, the more characters you set in your prefix, the longer it will take to generate a vanity address. Although doing charliefish
would have been cool, I estimate it would have taken hundreds of years to generate.
Step 1: Install Nginx
I'm assuming that you have a server ready to setup your Tor Onion Service on. I'm running it on a Ubuntu 22.04.3 LTS server. I'm also assuming that you have root access to the server.
So I'll run the following command to install Nginx:
sudo apt install nginx
Step 2: Configure Nginx
Let's now configure Nginx to serve our website. Let's modify the default Nginx configuration file:
sudo nano /etc/nginx/nginx.conf
Uncomment the following lines:
server_tokens off;
server_name_in_redirect off;
Then add the following line:
port_in_redirect off;
These options modify the nginx configuration to be more secure.
Now let's restart nginx:
sudo systemctl restart nginx
Step 3: Setup website
Let's modify our website by going to the following directory:
cd /var/www/html
Now let's create a file called index.html
:
sudo nano index.html
Add your contents that you want to your website.
Step 4: Install Tor
To install Tor, run the following command:
sudo apt install tor
Step 5: Configure Tor
sudo nano /etc/tor/torrc
Now we need to comment out the following lines:
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
Now run the following command to restart Tor:
sudo systemctl restart tor
Step 6: Setup vanity address (optional)
If you decided to create a vanity address in step 0, then you need to copy the contents from the ~/Tor/domainhere.onion
directory to the /var/lib/tor/hidden_service/
directory.
Then restart Tor again.
Step 7: Access your website
Now open your Tor Browser and navigate to your onion URL. You should be able to find your onion URL by running the following command:
sudo cat /var/lib/tor/hidden_service/hostname
Conclusion
And that's it! Super simple and easy to create a Tor Onion Service. Good luck in creating your own Tor Onion Service!