Skip to main content

Custom .onion v3 Domain Guide

ยท 4 min read
Ryan Achmad
soc & sysadmin

A .onion website runs on the Tor network, ensuring high anonymity. Follow these steps to set up your own hidden service.

๐Ÿ“Œ Requirementsโ€‹

  • Tor (to host the hidden service)
  • Web Server (Apache, Nginx, or frameworks like Flask/Django)
  • Tor Browser (to access the .onion website)

๐Ÿ› ๏ธ Step 1: Install Torโ€‹

๐Ÿ”น Linuxโ€‹

sudo apt update && sudo apt install tor

๐Ÿ”น Windowsโ€‹

  1. Download the Tor Expert Bundle
  2. Extract and run Tor.exe from CMD.

๐Ÿ› ๏ธ Step 2: Configure Tor Hidden Serviceโ€‹

Edit the torrc file:

  • Linux: /etc/tor/torrc
  • Windows: C:\Users\Username\torrc

Add the following lines:

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80

torrc2

Restart Tor:

sudo service tor restart

๐Ÿ› ๏ธ Step 3: Get Your .onion Domainโ€‹

Once Tor is running, check your assigned .onion address:

cat /var/lib/tor/hidden_service/hostname

Example output:

abcdefghijklm.onion

๐Ÿ› ๏ธ Step 4: Set Up a Web Serverโ€‹

๐Ÿ”น Apache (Linux)โ€‹

sudo apt install apache2

๐Ÿ”น Nginxโ€‹

Edit /etc/nginx/sites-available/default:

server {
listen 80;
server_name localhost;
root /var/www/html;
index index.html;
}

Restart Nginx:

sudo service nginx restart

๐Ÿ› ๏ธ Step 5: Upload Your Website Filesโ€‹

Place your HTML/PHP files in:

/var/www/html/

Or, if using Flask/Django, run the web server on port 80.


๐Ÿ› ๏ธ Step 6: Access the Website via Tor Browserโ€‹

  1. Open Tor Browser.
  2. Enter your .onion address.
  3. Your hidden website is now online! ๐ŸŽ‰

โš ๏ธ Security Tipsโ€‹

  • Do not expose your real IP address.
  • Use a sandbox or anonymous VPS.
  • Implement self-signed SSL if needed.

๐Ÿ”น Happy Hosting! ๐Ÿš€

๐ŸŒ Custom .onion v3 Domain (Vanity Address)

By default, .onion domains are random strings derived from a public key. However, with mkp224o, we can generate a customized (vanity) .onion address.

๐Ÿ“Œ Requirementsโ€‹

  • Tor (installed from the previous guide)
  • mkp224o (to generate vanity addresses)
  • Linux (recommended for compatibility)

๐Ÿ› ๏ธ Step 1: Install Dependenciesโ€‹

๐Ÿ”น Debian-based (Ubuntu, Kali, etc.)โ€‹

sudo apt update
sudo apt install gcc libsodium-dev make autoconf

๐Ÿ”น CentOS / RHELโ€‹

sudo yum install libsodium-devel
sudo yum groupinstall "Development Tools"

๐Ÿ› ๏ธ Step 2: Install mkp224oโ€‹

Clone the mkp224o repository and compile it:

git clone https://github.com/cathugger/mkp224o.git
cd mkp224o/
./autogen.sh
./configure
make

๐Ÿ› ๏ธ Step 3: Generate a Vanity .onion Addressโ€‹

Run the following command to generate a .onion address starting with "opsls":

./mkp224o opsls -t 50 -v -n 4 -d /tmp/

Explanation of parameters:

  • opsls: The prefix you want (e.g., opslsabc123.onion).
  • -t 50: Use 50 threads for faster processing.
  • -v: Verbose mode.
  • -n 4: Generate 4 different addresses.
  • -d /tmp/: Save results in /tmp/ directory.

Example output:

opsls6pv5tvhh6oh46g4etroea4j3q4e4lusjiviasbo4h3lr4gqd.onion
opsls27owmy4zuirqfucbq3nrz3wz6ggznunpnbakvsjdhfn2jlmr6yd.onion
opslswgds7zi4fkvrbmmrv7eplk2vtjjn6fqehl4jjezspwm577mfwad.onion

๐Ÿ› ๏ธ Step 4: Move and Configure the Custom Addressโ€‹

Pick one of the generated addresses and move it to Tor's hidden service directory:

mv /tmp/opsls27owmy4zuirqfucbq3nrz3wz6ggznunpnbakvsjdhfn2jlmr6yd.onion /var/lib/tor/opslinuxsec

Fix ownership and permissions:

chown -R debian-tor:debian-tor /var/lib/tor/opslinuxsec
chmod -R u+rwX,og-rwx /var/lib/tor/opslinuxsec

๐Ÿ› ๏ธ Step 5: Update torrc Configurationโ€‹

Edit Tor's configuration file:

nano /etc/tor/torrc

Modify the hidden service directory:

HiddenServiceDir /var/lib/tor/opslinuxsec/
HiddenServicePort 80 127.0.0.1:80

torrc

Save and restart Tor:

sudo systemctl restart tor

๐Ÿ› ๏ธ Step 6: Test Your Custom .onion Addressโ€‹

Open Tor Browser and enter your new .onion domain:

opsls27owmy4zuirqfucbq3nrz3wz6ggznunpnbakvsjdhfn2jlmr6yd.onion

If everything is set up correctly, your website should load! Example

If you have tor browser you can check my site in there

http://opsls27owmy4zuirqfucbq3nrz3wz6ggznunpnbakvsjdhfn2jlmr6yd.onion/

โš ๏ธ Security Tipsโ€‹

  • Never expose your private key.
  • Use a secure VPS or dedicated air-gapped machine.
  • Consider sandboxing Tor for extra security.

๐Ÿ”น Enjoy Your Custom .onion Domain! ๐Ÿš€

Sourceโ€‹

https://www.bentasker.co.uk/posts/documentation/linux/708-generating-a-vanity-address-for-version-3-onions.html https://medium.com/@rishabhlakhotia/setting-up-tor-hidden-service-8af1875921c6 https://community.torproject.org/onion-services/setup/