If you have a website hosted on Webfaction (or any other name-based virtual host, for that matter), and want to create a .onion copy of that website, then this guide is for you. After the break!
First, let’s get some definitions straight.
name-based virtual host: One user has a
/home/ partition. Each application(could be multiple domains) routes to a specific folder in
Tor: Service that allows your web traffic is sent through around three random computers before reaching its target, in order to preserve anonymity. Illustration (click to enlarge):
.onion: A domain that is resolved using a series of queries on the Tor network.
What we’ll be doing is pointing all of the Tor traffic that comes to the .onion to the daemon (in my case nginx) on the server.
I first contacted the Webfaction support staff to ask if this was allowed. I had to clarify several things:
- I would not be needing a dedicated IP address
- I would not be opening a port
- This will not overload Webfaction with a barrage of traffic
He (Ryan S) then OK’d my actions. I downloaded the source package from the Download page, under “Source code.”
I unpacked, then ran:
cd tor_folder/ ./configure --prefix=$HOME make make install
I now had a Tor binary in
I then needed to make a directory in which Tor could store some of my website configuration files. I made it in
I then edited
torrc in order to configure the node correctly. That troublesome file was in
It looked like a jumbled mess of code, I scrolled through until I found something that looks like:
HiddenServiceDir some_folder/ HiddenServicePort 80 some_IP:port
Change the first field,
HiddenServiceDir, to match the folder from above. The second part was a bit trickier.
If you know what port and IP your server is running, then fantastic! Just leave the 80, and plug the rest of the information in.
(PSST! If you’re on Webfaction, it’s this:)
HiddenServiceDir some_folder/ HiddenServicePort 80 localhost:2480
Otherwise, you have two options:
- Start up another httpd, like
lighthttpd, in the directory where your application is stored, and change
localhost:whatever_portto match that.
- Contact support and figure out what you can do
I opted to contact support, to reduce strain on the server.
I started Tor by running:
Then, I opened up my Control Panel (Webfaction’s unique panel), and configured my BernsteinBear website to also serve my .onion domain. I just added a domain (
To see what’s in it.
P.S. If you really want to take this forward, change your site root to your .onion domain!