Intro
So.. you want a .onion version of your website, whether thats a blog like this, or any other type of website.
- Hardware
All you need is a spare SBC Raspberry Pi, even the cheapest Pi Zero W for £15, but you can even get a cheapo SBC from Ali (OS installation will be different) Also a note, you can use the pi to do simple server tasks on top of the .onion creation.
Also have a SD Card handy!
How does it work?
Pretty much the pi just relays the data from my site to the Tor network and from there to your pc.
- Why?
Privacy, to learn, Proof of concept.
Setup
- Download: Raspberry Pi Imager
- Run it, Choose your device (eg, Pi Zero W) For OS, choose
Other > Pi OS LIte, And you will get a configuration pop up, open config and put wifi details, enable ssh, i set my hostname topiserver, set a password and turn off telementery. - Plug in your sd card with some adapter and flash the OS. Once flashed, insert the SD Card to the Pi, and power it
- If your on linux, just open terminal and do
ssh piserver.lan(If your router doesnt see .lan, find the IP if the Pi), type your password and your in! - Run
sudo apt update && sudo apt upgrade -y, thensudo apt install tor nginx -y, thensudo nano /etc/tor/torrc, Scroll to the bottom and add:
|
|
after, do CTRL+S, CTRL+X
Next, do sudo systemctl restart tor@default, and then sudo cat /var/lib/tor/icmt_hidden_service/hostname, great! you should see:
|
|
You got your onion address!
Next, run sudo nano /etc/nginx/sites-available/icmt and paste in this code:
(Change sussus.org to the website you want to be on Tor!!!)
|
|
after, do CTRL+S, CTRL+X
Now run:
sudo ln -s /etc/nginx/sites-available/icmt /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
-
To test if it works, Run:
curl -I http://127.0.0.1:8080, If you seeHTTP/1.1 200 OKat the top, all works! -
Optionally, if you want tor users to see:
at the top of your site
Go to your _headers file and add:
(Change the .onion to the address you got from sudo cat /var/lib/tor/icmt_hidden_service/hostname )
|
|
Note, only Onion-Location: is required, other 2 are for privacy.
If you dont have _headers, make one, if your using hugo, it will go into the static folder, if not, it will go in root directory, or public dir.