Tor /

Hidden

First install Tor. $ doas pkg_add tor

Now edit the torrc file $ doas $EDITOR /etc/tor/torrc

RunAsDaemon 1

HiddenServiceDir /path/to/whare/you/want/the/dir/files # This can be any path it just has to exist
HiddenServicePort <Port 1> 127.0.0.1:<Port 2> # for 99.99% of the time you can just set port 1 and 2 as the same port
to add more ports just add more HiddenServicePort
to add more .onion links just add more HiddenServiceDir with HiddenServicePort underneth

make sure the HiddenServiceDir path is owned by the user who will run Tor and has permission of 700

simply run $ tor
as the user you want to run Tor with and it will start

to get .onion address run $ doas cat /path/to/whare/you/want/the/dir/files/hostname

I would run $ tor
as a crontab like @reboot tor

I don't recommend running this via rc since so far it seems it will have to run as root and that is less secure, I would recommend you make a user only for running tor and run it there