5

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?

1

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.

1
  • you should not do it! First you will create a data leak and second you will turn your CMS haywire, I've tried this myself - there's no other correct solution but the one I've described in my answer.
    – Alexey Vesnin
    Sep 18 at 10:57
0

Well, you don't need anything except the NGinx and tor running on the same box: in nginx server block you utilize the include ability - so you will have two server blocks for defining listening address - a clearnet IP for open web and 127.0.0.7 for Tor - and separate logging, separate HTTPS certificates with corresponding host names in them to avoid collisions and data leaks and an environment variable for the darknet connection like DARKNET=1 or 0 correspondingly. Why do you need a variable? - To turn off any stats, ads and trackers for a darknet site to avoid privacy leaks: you do it on your CMS level by disabling blocks by the environmental variable value. You don't need anything else! As soon as you will make these server directives for http to https redirecting and for https site serving - just put the rest of your website config into the separate config file and include it as the last directive inside the https server definition block. That's it!

-1

https://github.com/alecmuffett/eotk

This is a way to do it.
There is also a way to do it with OnionShare.
https://onionshare.org/

1
  • Read the README for eotk and you will understand why it's totally not a good idea. And OninShare serves a way different purpose - the answer is misleading
    – Alexey Vesnin
    Sep 18 at 10:55

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.