How to set up onion service?

I want to serve a website through tor, so that I don’t have to pay a hosting service or provide my ip to the users.

I’ve followed the steps on Arch Wiki and

Step 0: Get a working Tor

$ yay -S tor
$ sudo systemctl enable --now tor.service

Step 1: Get a web server working

Previous steps.

$ cd ~/code/go/stash-box
$ ./stash-box --host --port 9998 &

Step 2: Configure your Tor Onion Service

Added this lines to /etc/tor/torrc

HiddenServiceDir /var/lib/tor/media_wiki/
HiddenServicePort 9998

Step 3: Restart Tor and check that it worked

$ sudo systemctl restart tor

Step 4: Test that your Onion Service works

When I visit the address in /var/lib/tor/media_wiki/hostname with the Tor Browser I see an Unable to connect message.

What else do I have to do?

This part seems relevant.

If your computer is not running a web server, and you have not set AccountingMax, consider changing your ORPort to 443 and/or your DirPort to 80. Many Tor users are stuck behind firewalls that only let them browse the web, and this change will let them reach your Tor relay. If you are already using ports 80 and 443, other useful ports are 22, 110, 143 and 9001.[1] Ports below 1024 are privileged ports, so to use those, Tor must be run as root by setting User=root in tor.service and User tor in torrc.

You may wish to review the Tor documentation.
Tor - ArchWiki

Not trying to sound condescending but you should learn about basic networking before taking up the responsibility of running a server.

HiddenServicePort 9998 means that, in order to access it, you will need to browse to <hostname>:9998 in the Tor Browser.

If you just want the default HTTP port, you can use HiddenServicePort 80

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.