I am trying to run two or more hidden services. My torrc seems to be fine, but I am having trouble with lighttpd.conf.

My configuration file contains.

$HTTP["host"] == "2uwvt4.onion" {
  server.document-root  = "/var/www"
  server.port           = 8888
} else $HTTP["host"] == "6gkcdh.onion" {
  server.document-root  = "/var/www/2"
  server.port           = 7777
} else $HTTP["host"] =~ "" {
  server.port           = 110
  server.document-root  = "/var/www/default"

I get the error that it is already bound to port 80, the port 80 is only mentioned once in torrc.

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80

HiddenServiceDir /var/lib/tor/hidden_service/2/
HiddenServicePort 90
  • "that it is already bound to port 80" Who gives this error? Tor? Lightty? Who is "it" in this sentence?
    – user66
    Commented Jul 18, 2014 at 13:40
  • Thank you for answering. Yes it is Lightty that is giving this error. In Lightty I have service.port = 80. I went back to trying to run just one hidden service, and it seems that I cannot connect unless HiddenServicePort 80 is set. Changing the first "80" or the second "80" doesn't seem to work. (I'm only 90% sure of that as usually I need to try to reconnect several times, even when it's good). If someone has a working example of two hidden services I'd greatly appreciate that. I've tried some of the examples I've found on net, but no luck.
    – Tommy H.
    Commented Jul 19, 2014 at 2:07
  • @TommyH. I hope that you don't mind that I recreated your question. The error was in lighttpd, it's true, but it's good to have an answer about running two HS on lighttpd.
    – mirimir
    Commented Jul 23, 2014 at 15:57

2 Answers 2


This StackOverflow question has the key to the answer. In lighttpd.conf there should be something like this:

## Document root
server.document-root = server_root + "/HS1"
$SERVER["socket"] == ":8080" {
        server.document-root = server_root + "/HS2"

Then in torrc, there should be something like this:

HiddenServiceDir /var/lib/tor/HS1
HiddenServicePort 80

HiddenServiceDir /var/lib/tor/HS2
HiddenServicePort 8080

You don't need to run them on separate port numbers; you can use host-based virtual-hosting with .onion domain names exactly as you would with clearnet domain names.

Having said that, if you're really paranoid about people discovering that the services are on the same server, you should use different port numbers.

Someone can connect to site1.onion and send a Host: header with site2.onion, and if the server replies as if it was site2.onion, then they will know they're hosted on the same server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .