[How To] Host an Onionsite (Tor Hidden Service)
Prerequisites
- A web page (a simple index.html works for testing)
- A web server, such as nginx
Steps
-
Install tor and start the service
Debian/Ubuntu
sudo apt update sudo apt install tor sudo systemctl start torArch
sudo pacman -Syu sudo pacman -S tor sudo systemctl start tor -
Configure tor
Uncomment the following lines in
/etc/tor/torrc, rename the directory if you like (remember this for the next step):HiddenServiceDir /var/lib/tor/onion/ HiddenServicePort 80 unix:/var/run/tor/onion.sock -
Configure web server (nginx example)
Place all the contents of your vanity address directory (created in the last guide) into
/var/lib/tor/onion/(or whatever you called it). Add your vanity address and socket info to your nginx config (/etc/nginx/conf.d/onion.confin this example). Make sure you get your directories correct.server { listen unix:/var/run/tor/onion.sock; server_name yourVanityOnionAddressxxxxxxxxxxxxxxxxxxxxxx.onion; index index.html root /var/www/onion/myOnionSite; location / { root /var/www/onion/myOnionSite; index index.html index.htm; } -
Place your website into your web root directory (/var/www/onion/myOnionSite) and restart tor
sudo systemctl restart tor
Troubleshooting
-
Check Tor logs for errors
sudo journalctl -u tor.service -efa -
Restart tor
sudo systemctl restart tor