How you can setup your Tor Website on AWS!

Kerem Demirtürk
3 min readNov 5, 2023

Hey there,

I’ve been thinking about creating my own Tor website for a while now, but I never got around to trying it. Today, during my trip from Cologne to Utrecht, I finally took the chance and succeeded. I want to share my experience with you, providing easy-to-follow explanations for the installation and configuration process.

First things first, before diving into the Tor setup, I knew I needed a server. So, I opened my AWS Console and created an EC2 instance. I opted for a t3.micro instance, created my own security group, allowed incoming requests on ports 80 and 443, allowed SSH access on port 22 only from my IP, and created an IAM role for AWS SSM connection permission. I also allowed a public IP assignment, although I didn’t assign an Elastic IP just yet since it was only for trial purposes. I’ll share some screenshots!

P.S => I have tor browser on my local either!

My Security Group:

IAM Role permissions:

SYS:

to learn your OS codename: (Take note )

lsb_release -c

Now, for the server setup, let’s begin by installing Tor and its prerequisites.

  • To enable all package managers using the libapt-pkg library to access metadata and packages available in sources accessible over https (Hypertext Transfer Protocol Secure).

apt install apt-transport-https

Create new file /etc/apt/sources.list.d/ named tor.list. Add the following entries:

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

Don’t forget to replace the <DISTRIBUTION> variable with your OS codename, which we previously noted.

Then add the gpg key used to sign the packages by running the following command at your command prompt:

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

Update your package list and install Tor:

# apt update
# apt install tor deb.torproject.org-keyring

With Tor successfully installed on our server, let’s move on to the Nginx configuration. You can use Apache as well, but I prefer Nginx.

Nginx Installation:

apt install nginx

Since I assigned a public IP to my server, I can now access Nginx from outside the instance.

Once you’ve confirmed that Nginx is working, let’s configure Tor using the “torrc” file. The “torrc” file can be found in “/etc/tor.”

Add the following lines to the configuration:

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

For more tips and information, you can check the Tor documentation page. I’ll reference some of their guidelines below.

Finally, restart Tor to see the results:

sudo systemctl restart tor

But where is my Tor domain? To find it, check the directory we specified earlier in “HiddenServiceDir.” Inside that directory, you’ll find a file called “hostname.” Open it to see your domain.

Mine was -> http://5fuu23xxu7lowfxl5lgbah3qvwmra43lzlgpilemcnhs6vgfosibread.onion/

Thank you for reading, you check real documentation from their website!

Source -> https://www.torproject.org/

Best Regards,

Kerem DEMIRTURK!

--

--