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!

IAmNoone
  • 1,863
  • 1
  • 11
  • 20
marbella
  • 31
  • 2

1 Answers1

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.

Jobiwan
  • 3,685
  • 2
  • 19
  • 31