#How to Set Up a Hidden (Onion|Tor) Service.html
>insanely easy, especially compared to conventional web hosting
1. Have a service running
>this can be any service
>write down what port its running on, this address will be referenced BELOW as
>for testing purposes lets use netcat
{
$ nc -l 1234
}
2. Configure Tor
{
HiddenServiceDir
HiddenServicePort 127.0.0.1:
}
>open the torrc your daemon is using ("/etc/tor/torrc" by default)
>tor will need to know where to store relevant information about the site
and which port it must mirror/proxy to the tor network
>you will also have to specify the dir for Tor to create(!) and store stuff at {"mynetcat"}
>if you're planning on hosting multiple hidden services its a good idea
to create a designated parent directory for all {"/var/lib/tor/hidden_service/"};
NOTE: double check permissions and owner (have it '7xx tor')
> is the outbound port through which one must connect to the service to access it
>NOTE: while in our case will be the same as ,
this would not apply, if we had, lets say,
a gitea running on port 3000;
there, we would set it to 80 (or 443),
because we would want to to behave normally from a browser
{ // configuration template populated with our example case
HiddenServiceDir /var/lib/tor/hidden_service/mynetcat
HiddenServicePort 1234 127.0.0.1:1234
}
>NOTE: for debugging, "tor --runasdaemon 0 --verify-config" could be useful
3. Restart tor
{
$ sudo systemctl restart tor # or with whatever init system you have, obviously
}
4. Get the address
{
$ cat /hostname
}
>an onion address is automatically created for your hidden service
{ // address location in our example
$ cat /var/lib/tor/hidden_service/mynetcat/hostname
}
5. Verify
>it should be online now, allowing us to connect
>test it
{
$ torify nc jsBsjBsn2j59poqndnajk45ndtjsbA6bsjubyeqzfqhxcgujsadnmi5d.onion 1234
}