Skip to content
Home » Articles » HOW TO SETUP A TOR ONIONSITE ON APACHE

HOW TO SETUP A TOR ONIONSITE ON APACHE

Here is a simple how-to guide on setting it up in 2024

First you will want a server that has nothing on it and is not publicly available. I suggest getting a spare PC, or setting it up on a VM.

Make sure the PC/VM is on a standalone VLAN and behind a firewall so no other traffic can get to it. Open NO Ports, setup No NATs, TOR does not need them open to function properly.

First, Install Ubuntu Server 22.04 or Ubuntu Server 24.04

Then ssh into the server

Type:
sudo su –

dpkg –print-architecture

If it is either amd64, arm64 or i386, it will work, if it is not any of those structures, find a different system to run it on.

Type:
apt install apt-transport-https

lsb_release -a

What is your version of linux? It wil be listed as something like
Codename: focal
or
Codename: jammy
or whatever the latest flavor is

Install Apache:
apt-get update

apt install apache2

mv /var/www/html/index.html /var/www/html/index.html.orig

nano /var/www/html/index.html

Type in
Hi, You Found Me!

Save and Exit

Now Type:
cd /etc/apt/sources.list.d/

nano tor.list

paste in this:
deb     [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org <DISTRIBUTION> main

Change <DISTRIBUTION> to focal or jammy or whatever, so it looks like this:
deb [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org jammy main
deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org jammy main

Save and Exit

Now type:
wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg –dearmor | tee /usr/share/keyrings/tor-archive-keyring.gpg >/dev/null

apt update

apt install tor deb.torproject.org-keyring

nano /etc/tor/torrc

Uncomment these lines by deleting the #

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

Save and Exit

systemctl restart tor

systemctl restart apache2

cat /var/lib/tor/hidden_service/hostname

and your onion site will show like this:
longleycr37tvhhrxmbs3buk3ze6vtpyouz3gy6uytdqqfvoiqrf3yyd.onion

Now you can go to a site like torgateway.com and browse to that onion site to ensure it is live. I would prefer if you actually used your own tor browser instead using a setup like the one I created here for Tor and Tails.

Enjoy the darkweb!