Step 1: Install Debian

  • Prepare Debian to install https packages sudo apt install apt-transport-https

Step 2: Install Nginx and PHP

  • sudo apt install nginx php7.3-fpm
  • sudo rm /etc/nginx/sites-enabled/default
  • sudo nano /etc/nginx/sites-enabled/default
  • Add the followings to the new /etc/nginx/sites-enabled/default and save:
server {
    listen default_server;
    server_name localhost;

    root /var/www/tor/public;
    index index.php index.html index.htm;
    server_tokens off;

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

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Step 3: Install Tor for the website

  • sudo nano /etc/apt/sources.list
  • You need to add the following entries to /etc/apt/sources.list:
deb buster main
deb-src buster main
gpg --keyserver --recv A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89
gpg --export A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89 | sudo apt-key add -
  • Proceed with the instalation:
sudo apt update
sudo apt install tor
  • Proceed with the configuration:
sudo nano /etc/tor/torrc


#HiddenServiceDir /var/lib/tor/hidden_service/
#HiddenServicePort 80


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

Step 4: Fire it up!

sudo systemctl restart tor nginx php-fpm

To retrive the website .onion link:

cat /var/lib/tor/hidden_service/hostname

Step 5: Create a directory for the site and host it

mkdir -p /var/www/tor/public