ONIONSITE HOSTING

2025-05-16

[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

  1. Install tor and start the service

    Debian/Ubuntu

    sudo apt update
    sudo apt install tor
    sudo systemctl start tor
    

    Arch

    sudo pacman -Syu
    sudo pacman -S tor
    sudo systemctl start tor
    
  2. 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
    
  3. 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.conf in 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;
    }
    
  4. 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
    

Resources