3

I would like to setup 3 hidden services on the same computer with nginx.

My torrc looks like this:

DataDirectory /var/lib/tor  
HiddenServiceDir /var/lib/tor/hidden_service/   
HiddenServicePort 80 127.0.0.1:80   

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

HiddenServiceDir /var/lib/tor/hidden_service2/  
HiddenServicePort 80 127.0.0.1:8082  

I have 3 files in /etc/nginx/sites-available:

  • hidden_service
  • hidden_service1
  • hidden_service2

hidden_service:

server{  
listen  127.0.0.1:80;  

root /var/www/hidden_service/;  
index index.html index.htm;  
server_name xxxxx.onion;  
}

hidden_service1:

server{  
listen  127.0.0.1:8081;  

root /var/www/hidden_service/;  
index index.html index.htm; 
server_name yyyyy.onion;  
}

hidden_service2:

server{  
listen  127.0.0.1:8082;  

root /var/www/hidden_service/;  
index index.html index.htm;  
server_name zzzzz.onion;  
}

Symbolic links are created between sites-available and sites-enabled.

The first hidden_service is working.But the other two are not connecting. I tried with different port number and tried with the same port number but no luck. What am I doing wrong?

Thank You in advance!

  • 2
    The first entry in your Nginx config file seems to be listening to port 80 (listen 127.0.0.1:80;), which is the virtual port specified for all services in the torrc file. Have you tried changing this? (e.g.) Change the three target ports in the torrc to 8081, 8082, 8083 (but keep the virtual port as 80 for each of them), then change the Nginx config to listen 127.0.0.1:8081, listen 127.0.0.1:8082, listen 127.0.0.1:83. At the minute, the first entry in the Nginx config is catching everything because they all use the same virtual port. (I think... ) – Richard Horrocks Nov 10 '15 at 17:24
1

You can not listen on the same port multiple times.

There are 2 possibilities:

If you want your HSs to listen on different ports, then you should change your HiddenServicePort directives so they use different port numbers. (Like Richard Horrocks suggests in his comment.)

If you want them all on the same port, then you should have only one HiddenServicePort directive, and configure your web server to use virtual servers so that it hits the document root based on the server name in the request.

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.