5

I am using centos 7 and apache with the latest version of Tor.

When I add a second HiddenServiceDir line to the torrc file, not only does the second (or third or fourth) service not work, it also makes my first service stop working. I have looked everywhere I could think of and read every guide I can find for answers, but I can't figure it out. Please help!


This is what I have added to /etc/httpd/conf/httpd.conf

Listen 80

Listen 127.0.0.1:6986
Listen 127.0.0.1:7786

<VirtualHost 127.0.0.1:6986>
   ServerName mydomain2.onion
   DocumentRoot /var/www/mysite2/public_html
</VirtualHost>

<VirtualHost 127.0.0.1:7786>
  ServerName mydomain3.onion
  DocumentRoot /var/www/mysite3/public_html
</VirtualHost>

This is what I have added to /etc/tor/torrc

HiddenServiceDir /var/lib/tor/mysite1/
HiddenServicePort 80 127.0.0.1:80

HiddenServiceDir /var/lib/tor/mysite2/
HiddenServicePort 6986 127.0.0.1:6986

HiddenServiceDir /var/lib/tor/mysite3/
HiddenServicePort 7786 127.0.0.1:7786

As guides I am using seem to differ on this point, I have also tried it with the serviceport lines like:

HiddenServicePort 80 127.0.0.1:6986

When I put #s in front of the four last lines, the first one goes right back to working.

Thank you for looking at my question. Any suggestions will be very much appreciated.

1

it also makes my first service stop working

This indicates that the problem is with your Tor, not with your web server. You should be able to confirm this by connecting directly to your web server from the same host.

Does your Tor successfully start up at all? Check your Tor log file to see if it complains about anything related to hidden services.

My best guess would be ownership and/or permissions on your hidden service directories. (Should be 700 or drwx------) Did you have Tor generate your keys or did you copy your own private keys or even hostname files into them? If you copied them in, make sure they have correct ownership and permissions as well. (Should be 600 or -rw-------)

Just some suggestions:
The port for your HS and the port it connects to don't have to be the same. You can do HiddenServicePort 80 127.0.0.1:7786 for example. This way, your users don't have to specify a port number and just connect to 80. You can have multiple onions use the same port number.

On the Apache side, you can also use the same port number for multiple VirtualHosts, since they have different ServerNames.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.