Creating your own Tor/Deep Web Hidden Service website with NGINX

What you will need:

  • A Server with a public IP Address where you can install Tor and NGINX.

Adding the “deb.torproject.org” repository:

curl https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --import
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | apt-key add -

Installing necessary packages:

apt update
apt install nginx tor

Configuring Tor Hidden Service:

cd /etc/tor/

Saving the default torrec file:

mv torrec torrec.default

Creating new torrec file:

vim torrec
SocksPort 0 #If local.
SocksListenAddress 127.0.0.1 #Only allow local connections.
RunAsDaemon 1
DataDirectory /var/lib/tor

HiddenServiceDir /var/lib/tor/service/
HiddenServicePort 80 127.0.0.1:2643

Restarting Tor:

systemctl restart tor

In “/var/lib/tor/service/hostname” you will find your .onion Domain

cat /var/lib/tor/service/hostname

Configuring NGINX:

vim /etc/nginx/sites-available/default
server{
  listen 127.0.0.1:2643;
  root /var/www/html;
  index index.html index.html index.php;
  server_name youroniondomain.onion;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    fastcgi_pass unix:/var/run/php7.3-fpm.sock;
  }

}

Restarting NGINX:

systemctl restart nginx

Leave a Reply

Your email address will not be published. Required fields are marked *