Mirror Your Site Over Tor

Now that you have a website, why not offer it on a private alternative such as the onion network?

Setting up Tor

First, install tor. On Debian it's as simple as:

 apt install tor

Then edit the file /etc/tor/torrc, uncommenting the following lines:

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

Now restart tor

 systemctl enable --now tor 

If the next command outputs active in green you're golden!

 systemctl status tor

Now you're server is on the dark web. The following command will give you your onion address:

 cat /var/lib/tor/hidden_service/hostname

Adding the Nginx Config

From here, the steps are almost identical to setting up a normal website configuration file. Follow the steps as if you were making a new website on the webserver tutorial up until the server block of code. Instead, paste this:

        server {
            listen 127.0.0.1:80 ;
            root /var/www/landchad ;
            index index.html ;
            server_name your-onion-address.onion ;
        }

From here we are almost done, all we have to do is enable the site and reload nginx which is also covered in the webserver tutorial.

Contributor - tomfasano.xyz