Building a website on the Tor network

Mutt

Professional
Messages
1,057
Reputation
7
Reaction score
595
Points
113
At first glance, it may seem difficult to get your website up and running on the Tor network, but in reality everything is different. First, you need to install and configure NGINX.All the steps below for installing and configuring will be done on a server running Debian 10.

Code:
sudo apt install tor
sudo nano /etc/tor/torrc

Then uncomment the lines with HiddenServiceDir and HiddenServicePort, edit and save.

By default, the directory of your Tor service will be /var/lib/tor/hidden_service/, you can change it as well as the listening port. Then just restart the Tor service with the command sudo systemctl restart tor.

Onion, the link to your site will be saved in a file /var/lib/tor/hidden_service/hostname, and files ending in _key will contain keys for generating the domain, they should be saved.

In the configuration file (server section) NGINX of our site, we will add the following line containing the previously recorded data in the HiddenServicePort - listen 127.0.0.1:80;

And restart NGINX with the command sudo systemctl restart nginx.

Create .onion available button in Tor browser
Many have probably seen that when in the Tor browser you go to a site using a white link, an onion available button appears next to the URL field, which redirects to the onion version of the site. Such a button is made with the help of additional headers that need to be registered in the site configuration, in the server section:add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";

Code:
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;

add_header Onion-Location http://вашассылка.onion$request_uri;In the appropriate place, insert the required .onion link without a slash and with a protocol at the beginning. After we edited the config again, we should restart our NGINX with the same command. You can read about the nginks setup here.
 
Top