For adding multiple Tor services in the same server, it is as simple as editing /etc/tor/torrc
and adding two lines per each service, each with it´s own directory under /var/lib/tor/ ;
For instance, to launch another two web sites in the same server, you can leave in the right side also port 80, and in the left side, using another port in the localhost
side as in:
HiddenServiceDir /var/lib/tor/www2_service/
HiddenServicePort 80 127.0.0.1:8080
HiddenServiceDir /var/lib/tor/www3_service/
HiddenServicePort 80 127.0.0.1:8081
I would add a note that the part of leaving as the Tor side the port 80 for several sites is a welcomed facility, as it does not obliges the user to add a port after a URL to access an onion site/service, allowing the mapping of TCP-based services in their canonical ports to ports of your own choice in the local server.
nginx would then be configured with 2 new vhosts:
server {
listen 127.0.0.1:8080;
server_name zyew6pdq6fv4i6sz.onion;
...
}
server {
listen 127.0.0.1:8081;
server_name yyew6pdh6hv1i3sy.onion;
...
}
If also need arises to temporarily to access the ssh service via Tor as a poor man's VPN, and to bypass firewall rules, a 4th entry to the /etc/tor/torrc
file can also be added:
HiddenServiceDir /var/lib/tor/ssh_service/
HiddenServicePort 22 127.0.0.1:22
As mentioned in How to create a darknet/Tor web site in Linux?, after you run:
service tor reload
the directories will be created, and inside of each of the new directories, two files are generated automatically, hostname
and private_key
.
The content of the hostname
file inside each directory with be the new .onion
address by which the corresponding new services can be used inside the Tor network.