I'm running a website with Nginx which I would like to be accessible by Tor and by clearnet. Currently it's only reachable by clearnet, e.g. www.example.com.

Of course people just can go to www.example.com through Tor browser, but I want to have a .onion address too for the same website.

I want the website and content to be accessible by www.example.com/ and xyzsfexample.onion/. So they see content from /var/www/www.example.com/web/index.php as xyzsfexample.onion/index.php ; IF they browse on xyzsfexample.onion ; IF they browse on example.com they should see example.com/index.php

How do I set this up and how must Nginx be configured to do both?


What you can use is nginx url rewrite.

There are many examples on stack overflow. One example is :

Nginx rewrite domain and URLs https://stackoverflow.com/q/14565382/485626

you detect what url they requested and then rewrite it properly so that it can be used on any of the two domains.

| improve this answer | |

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.