#Access Your Site via the Tor Network
Introduction: Embracing the Dark Side
Join the ranks of websites embracing anonymity with an onion domain. Just like Facebook, you can now make your site accessible via the Tor protocol, allowing users to navigate through the depths of the internet securely. Welcome to the era where your site exists in both the clearnet and the darknet. Don’t forget to equip yourself with the Tor Browser for this journey.
Onion Odyssey: Setting Up Tor
Installing Tor
Begin by editing sources.list
:
sudo nano /etc/apt/sources.list
Add the Tor repository:
deb https://deb.torproject.org/torproject.org stretch main
deb-src https://deb.torproject.org/torproject.org stretch main
Next, add the repository keys:
gpg2 --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg2 --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -
Update the package list and install Tor:
sudo apt update && sudo apt install tor
Configuring Tor
Edit the Tor configuration file:
sudo nano /etc/tor/torrc
Configure Tor to serve your .onion domain:
SocksPort 9050
RunAsDaemon 1
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServiceVersion 3
HiddenServicePort 80 127.0.0.1:8123
Restart Tor:
sudo service tor restart
Your onion domain’s private key can be found in /var/lib/tor/hidden_service/
. The address is located in the hostname
file.
Nginx Navigation: Configuring the Web Server
Nginx Configuration
Create a new configuration file for your onion domain:
sudo nano /etc/nginx/sites-available/youronionconfiguration
Add the following content, adjusting port, root folder, and server name accordingly:
server {
listen 127.0.0.1:8123;
root /var/www/yourwebsite;
index index.html index.htm index.php;
server_name youronionaddress.onion;
}
Save the file and activate the configuration:
sudo ln -s /etc/nginx/sites-available/youronionconfiguration /etc/nginx/sites-enabled/youronionconfiguration
Testing and Restarting Nginx
Test the Nginx configuration:
sudo nginx -t
If successful, restart the web server:
sudo service nginx restart
Informing the World: Adding Onion Location
As of Feb 6th, you can notify visitors of your onion address. Follow the official Tor Project blog post for detailed instructions. In short, add the following header to your server configuration.
Nginx Example
Edit your website configuration:
sudo nano /etc/nginx/conf.d/<your-website>.conf
Add the line:
add_header Onion-Location http://<your-onion-address>.onion$request_uri;
Apache Example
sudo nano /etc/apache2/sites-available/<your-website>.conf
Add the line:
Header set Onion-Location "http://your-onion-address.onion%{REQUEST_URI}s"
Now, visitors using Tor Browser will be informed of your onion domain when accessing your site via the standard domain.
Conclusion: Embrace the Shadows
Congratulations! Your website now shines a light in both the clearnet and the darknet, thanks to its onion domain. Navigate through the depths of cyberspace securely and anonymously. Embrace the shadows and welcome visitors from all corners of the internet.