How to create mirror in Tor with .onion domain?

Hello! I’m using a standard installation of Docker Discourse on Ubuntu and want to setup a forum mirror in .onion Tor network.

I have installed Tor on server and now I have myonionsite.onion address.

#install
apt install -y tor

#uncomment in /etc/tor/torrc
HiddenServiceDir /var/lib/tor/myonionsite/
HiddenServicePort 80 127.0.0.1:8080
HiddenServiceVersion 3

#restart
systemctl restart tor
systemctl enable tor

cat /var/lib/tor/myonionsite/hostname

But this address show default nginx page, not my community.

Need help :pleading_face: :pray:

1 Like

There is a TOR template for discourse:

It was last updated 6 years ago so I’m not sure if it’d still work but if it still works, this should get you going. Read the template to understand how it works.

You’ll need to include the template in your app.yml and define DISCOURSE_ONION link (which is your .onion address.

Further discussion: Template for serving through an .onion address with Docker

5 Likes

Doesn’t work or am I doing something wrong…

My steps:

  1. apt install tor

  2. edit file /etc/tor/torrc

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:8080
HiddenServiceVersion 3
  1. restart
systemctl restart tor
systemctl enable tor
  1. check my onion domain
cat /var/lib/tor/hidden_service/hostname
  1. go to cd /var/discourse/ and edit app.yml
    add templates web.onion.template.yml
    add DISCOURSE_ONION look like:
DISCOURSE_HOSTNAME example.com
DISCOURSE_ONION example.onion
  1. ./launcher rebuild app

After these settings, the forum is not available in clearnet and in Tor. Maybe I need change post? :pensive:

Maybe I need install new nginx? 1. apt install nginx tor

Hi mate, did you find solution to setting up TOR correctly ?

The web.onion.template.yml needs some updates in order to work.

Please try this patch.

Besides that, you probably also need to point HiddenServicePort to 80 127.0.0.1:80 instead of 80 127.0.0.1:8080.

2 Likes

How we can do it if we are not exposing Discourse directly because using aproxy like Nginx?

Using the container IP should work? (: