I have several virtual hosts on traditional Nginx and Apache servers. They listen on ports 80 & 443. I would like to also make those sites available as hidden services (e.g. "This site is also available at XYZ.onion" in the footer) by installing Tor on those same servers.

Is there a practical way to do this? Put differently, does serving Tor hidden services require a separate server or can it be used in tandem with a traditional LAMP server?

1 Answer 1


It can be run with a traditional server setup, there are certain pitfalls because most Apache, PHP + MySQL setups aren't intended for the kind of privacy that some onion services require.

However, offering an onion service for an already public website should be a simple task.

Essentially Tor just points the onion service at some endpoint, e.g. and any connections made to the onion service tor will create a connection to your chosen endpoint for and ferry the connection data back and forth.

So adding a simple hidden service configuration to your torrc:

HiddenServiceDir /var/lib/tor/onion
HiddenServicePort 80 # Port 80 on the onion corresponds to localhost port 80

Then ensure your webserver treats the .onion virtualhost as expected (the address will be written to /var/lib/tor/onion/hostname) and that should be enough to get it to work.

If you have requirements of the webservice being anonymous then I'd strongly recommend at both containing it by VM or some other container and using a restrictive firewall to block accidental network leaks. See the RiseUp Hidden Service Best Practises too.

  • Thanks, I had hoped to accept your answer sooner and have this tested and working by now, but the documentation is very light on configuration details for linux (e.g. what user it runs as, permissions, ports, etc...). Installation was easy but I can't get it to run properly. I'll have to try this again some day. Jan 4, 2017 at 18:30

You must log in to answer this question.

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