Hosting your own hidden onion service
Saturday, May 11, 2019 •
sudo apt-get install tor
You’ll need a webserver already. I assume, you are running apache.
Configure your onion service in
HiddenServiceDir /var/lib/tor/hidden_service_myname/ HiddenServicePort 80 127.0.0.1:80
mynamewith your choice. Any request on port 80 on your hidden service will then be redirected to port 80 on localhost - that’s where your apache webserver is running.
Restart tor service:
sudo systemctl restart tor.service
Check out your hostname of the hidden service:
sudo cat /var/lib/tor/hidden_service_myname/hostname. You’ll see a hostname ending in “.onion”. Remember this - this is your onion hostname.
Configure your webserver, add a name-based virtual host:
<VirtualHost *:80> ServerName xyzyourhiddenservicehostnamexyz.onion DocumentRoot /srv/www/myname/htdocs </VirtualHost>
Restart your webserver
Try it out with the tor browser.
That way, I made this homepage also available as t2irhp5ym2ioy7jivr7oomg2gt2y3mbmtshenveh7eymp7ho3l3hvhyd.onion.
One note: the hostname depends on the generated public/private key pair that
tor generated for your onion service.
These keys are available in the “HiddenServiceDir” (e.g.
/var/lib/tor/hidden_service_myname/). If you want to keep your address,
you better make sure, to backup this directory.
More detailed information can be found on Configuring Onion Services for Tor.