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?

  • Nginx won't care if the site is served in the clear or over the TOR network. You can set up server blocks ('virtual servers') for your different domains, which I suspect is necessary, though perhaps not. Either way, you can have both domains served from the same directory to reduce content duplication, it's just a matter of figuring out how to serve a TOR website at all. I suspect you may get better answers in the Server Fault SE site (I flagged the question for a moderator to consider migration). – Paul Aug 19 '14 at 16:49
  • Have you considered using a ServerBlock in Nginx to define a website and then using Tor's guide to hidden services to setup the onion address (torproject.org/docs/tor-hidden-service.html.en)? – Terry Oct 10 '14 at 13:43
server {
    listen 80;
    server_name example.com xyzsfexample.onion;

    root /var/www/www.example.com/web/;
    index index.php;

| 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.