1

I have a few hidden services on my Ubuntu Server using Nginx. My torrc looks something like this:

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

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

I can access the homepage of both using their onion addresses, but clicking any subdirectories e.g. *.onion/blog/ sends me to *.onion:8081/blog/

I know all the basics are set up correctly, I can access both sites from localhost and through Tor, but anything besides the index page is sent to the local port, not the virtual port.

My Nginx configuration for HS1 is:

server {
        listen 127.0.0.1:8081;
        server_name testoniondomain1.onion;
        root /var/www/sites/hs1;
        index index.html index.htm index.php;
}

Am I missing something obvious or is there a problem with my configuration? Thank you in advance

1 Answer 1

2

Are you sure it's clicking on subdirectories causing the problem? nginx should just provide any existing file/directory that exists, and should not be aware what port it is serving the content on.

If, on the other hand, the problem is that going to *.onion/subdir (no slash at the end) redirects to *.onion:8081/subdir/, then you might be looking for the port_in_redirect off directive in the server block, as described in:

http://nginx.org/en/docs/http/ngx_http_core_module.html#port_in_redirect

If you are using further proxied servers, there may be other tweaks needed.

1
  • +1 port_in_redirect was exactly what I was missing, thank you!
    – jpl42
    Commented Dec 16, 2015 at 2:09

You must log in to answer this question.

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