How to create mirror in Tor with .onion domain?

Hello!

I’m using a standard installation of Docker Discourse on Ubuntu with clearnet domain example.com and want to setup a forum mirror in .onion Tor network.

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

But it’s not work :pensive:

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

When I change port 8080 to 80, my example.onion domain redirict to example.com

3. restart

systemctl restart tor
systemctl enable tor

4. check my onion domain

cat /var/lib/tor/hidden_service/hostname

5. 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

This web.onion.template.yml on GitHub

  1. ./launcher rebuild app

Please help :pleading_face: :pray:

Hello and welcome to the forum.

I suppose that’s the only problem.
Nginx receives the request on port 80, and is configured to forward all requests to port 443 to respond via HTTPS. So my guess.

You must either open another port in Nginx, such as 8080 that does not forward to 443, or remove the forwarding.

Find the line where the redirect is configured. I would first try to disable the forwarding as follows:

if ($remote_addr != 127.0.0.1) {
  return 301 https://$host$request_uri;
}
3 Likes