🌐 How to Create a .onion Website (Tor Hidden Service)
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
- Download the Tor Expert Bundle
- 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
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
- Open Tor Browser.
- Enter your .onion address.
- 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
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!
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/