The one and only: Tor
Host your own onion site! - 3 mins
Welcome to one of my first actual blog posts. So lets get to the point of this blog: What is tor? why tor? what is onion? why onion?
What is Tor?
If you didnt know what tor is already, its to complicated for me to explain tbh. So i recommend reading What is Tor. to understand it better.
Why Tor?
Tor being 100% anon means its safer and some people prefer onionsites over clearnet sites (non onion sites). See the diagram below for how onion sites actually work.
take from this blog post
ive also ran tests of my own to make sure onionsites cant get ip’s as my tests return 127.0.0.1 for my onion site.
What is an Onion Site?
oh yea i forgot to explain that. An onion site also know as hidden service is pretty much hidding your site/services/ports behind an onion address. With or without an outbound connection you can setup on anion site.
my-ip-here -> 8g7uthudtdiygnuyjgbeujfyrgbeujyfvrsujbf.onion
[i dont have an ip but im on the internet] -> hsuyjbfc8e7fyhe8urygfhyuzkjygfsbuskfr.onion
fyi those are not real onion addresses
Onion sites dont use ssl as the tor protocol encrypts the traffic!
But ive heard onion sites are bad !!1!
Yeah there may be some super shady parts to it such as “darkweb” but in countries with heavy censorship like china, iran etc. You can use tor bridges to get around the censorship. There are also good onion sites for free and good access such as.
an1d many more.
Setup your own onion site
well you should have your own! there are many benifits from it obviously. you dont have an outbound ip and are hosting from a raspberry pi, setup your onion site and people with tor can easily access your site. You want to host a site in general, giving it a .onion address is like a free domain (and secure)
Server setup
Assuming you have some vps, device in ur basement, raspberry pi, or just your personal device you should most likely be able to install tor on it! I would also recommend looking at this list which contains some ISP’s which dont like tor.. or just if your internet connection just blocks tor overall there may be some issues.
Installing tor
anyways to install tor on ubuntu at least its:
apt install -y tor
you may find otherways to install tor for other distros here
and wow tor is installed! now time to configure tor to run an onion site.
run nano /etc/tor/torrc and find the commented lines which have HiddenServiceDir and modify the content to:
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
this will make tor create a hidden service directory in /var/lib/tor/hidden_service/ and will run a hidden service on port 80 on your local machine.
to get your onion address run cat /var/lib/tor/hidden_service/hostname and you should see something like:
8g7uthudtdiygnuyjgbeujfyrgbeujyfvrsujbf.onion
Now restart tor by running systemctl restart tor.
And now i should be abl- oh wait there is no site..
Build the site w/ nginx + html
Well if you didnt know you will need nginx to handle the html because nginx is peak:P nginx is a web server which can handle html and serve it to the internet.
to install nginx on ubuntu run:
sudo apt install nginx
installing on other distors is prob just <pkg manager> <install> nginx
Here is a config which should work.
server {
listen 80;
server_name <your-onion-address>.onion;
location / {
html /var/www/html;
index index.html;
}
}
once you have setup make sure you nginx works by checking its status with sudo systemctl status nginx
Then… check your onion site on tor and then tada! it works yayyy
Conclusion
Tor and onion sites empower individuals to bypass censorship and protect their privacy. By hosting your own onion site, you contribute to a free and open internet for everyone. Keep your site public, accessible, and censorship-resistant!