What is Nostr?
laanwj /
npub1p23…rnl6
2024-09-28 07:59:59
in reply to nevent1q…ll26

laanwj on Nostr: In principle, it's the same as making any TCP service accessible from tor there's ...

In principle, it's the same as making any TCP service accessible from tor
there's many guides available for this, the basic steps are to install tor, then add to /etc/tor/torrc:

HiddenServiceDir /var/lib/tor/nostr_relay/
HiddenServicePort 80 127.0.0.1:8081

We're using port 80 instead of 443 because using TLS behind Tor is only a hassle in most cases (Tor already provides equivalent encryption). Where to redirect it depends on how your relay is configured.

In my case i use nostr-rs-relay (listening on 127.0.0.1:8081). In front of this i have nginx reverse-proxying to provide TLS. However, because nginx isn't really doing anything useful there, i can redirect Tor to its local HTTP port directly. Easy but YMMV.

Another option if you do want Tor connections to go through say, nginx (for example if you're providing extra pages or services on the domain), would be to add another plain http service port (say, port 81, then make Tor connect there), specifically configured for the onion HTTP. But that's web server specific.
Author Public Key
npub1p23eukh0nxsqpfaakz6fj9vvj27y4gs0kevnrffdq4d4adkl7uuq7crnl6