Taha Azzaoui

Hosting This Site on The Tor Network


I’ve previously gone over setting up tor to be able to access hidden services. This time I thought it would be cool to host a hidden service of my own.

Now obviously the point of hidden services is to publish sites anonymously, but since I’ll just be serving my personal site I’m not too concerned with anonymity.

Setting Up the Hidden Service

  1. Start by installing tor (obviously). It should be available via your local package manager.

    $ sudo apt install tor

  2. Next, edit the configuration file

    $ sudo vim /etc/tor/torrc

    Uncomment the line that reads

    RunAsDaemon 1

    as well as the line that reads

    DataDirectory /var/lib/tor

    Jump down to the section labeled

    ############### This section is just for location-hidden services ###

    Uncomment the two lines

     HiddenServiceDir /var/lib/tor/hidden_service/
     HiddenServicePort 80
  3. Start the tor daemon

    $ sudo systemctl start tor
    $ sudo systemctl enable tor

    To see your generated .onion address, run

    $ sudo cat /var/lib/tor/hidden_service/hostname

  4. Edit your web server configuration. I’m using Apache in this case. Locate the site configuration in use, found in /etc/apache2/sites-available/ and add the line

    ServerAlias <your generated address>.onion

    directly under where the ServerName is specified.

    Finally, restart Apache

    $ sudo systemctl restart apache2

Word, the hidden service should be live. You can use the tor-browser to check this one out: 6l4nq4v7nqffriew.onion