How To Host An Onionsite

2025-05-16


Host an Onionsite (Tor Hidden Service)

Prerequisites

Pre-requisites:

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
  1. 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
  1. 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;
        }

  1. Place your website into your web root directory (/var/www/onion/myOnionSite) and restart tor
  sudo systemctl restart tor

Troubleshooting

Resources

Tor Project Community