# Questions about leak prevention

**URL:** https://forum.torproject.org/t/questions-about-leak-prevention/21928
**Category:** Onion Services
**Tags:** tor
**Created:** [July 30, 2026, 10:54am UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928 "2026-07-30T10:54:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![EatYourSprinkles](https://forum.torproject.org/user_avatar/forum.torproject.org/eatyoursprinkles/32/9024_2.png) [@EatYourSprinkles](https://forum.torproject.org/u/EatYourSprinkles)
#### Post date: [July 30, 2026, 10:54am UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/1 "2026-07-30T10:54:01Z")

</div>

I am following the guide at

> **[Tor Project | Set up Your Onion Service](https://community.torproject.org/onion-services/setup/)**
>
> Defend yourself against tracking and surveillance. Circumvent censorship. | Set up Your Onion Service

I am new to this and I wanted to host a simple html site for learning purposes, I got to the following part:

> **Tip:** A good practice to avoid leaking an Onion Service to a local network is to run Onion Services over Unix sockets instead of a TCP socket. You will need to add the following two lines to your `torrc` file:
> 
> ```auto
> HiddenServiceDir /var/lib/tor/my-website/
> HiddenServicePort 80 unix:/var/run/tor/my-website.sock
> 
> ```

I am a little confused, further up in the guide the example website name was my\_website

So, my question is, when it says my-website is the - a typo and is supposed to be an underscore or is that a different name on purpose? If the name I use is onion, should the part about leaking prevention also be onion or should it be something else?

Thanks in advance for the help.

---

<div class="post-metadata">

### Author: ![Lind](https://forum.torproject.org/user_avatar/forum.torproject.org/lind/32/7525_2.png) [@Lind](https://forum.torproject.org/u/Lind)
#### Post date: [August 5, 2026, 2:06pm UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/2 "2026-08-05T14:06:59Z")

</div>

The my-website or my\_website in the guide is largely an example string which you can replace with anything as long as it works.

The `HiddenServiceDir` is not the place you put your website content (like index.html) in. The `HiddenServiceDir` is where Tor daemon stores the necessary files of this specific Onion service (like Onion service private, public keypair, onion client authorization pubkeys). To serve a webpage over onion service, you need to have a web server running, configure it to serve the webpage, and direct the `HiddenServicePort` to the port it’s listening on.  
For example, if you used `python -m http.server` to start a simple http server on port 8000, you need to have `HiddenServicePort 80 127.0.0.1 8000` configured in torrc so you can access the web server by visiting the onion service from a Tor browser. (Don’t use python’s built in web server if you’re running an onion service seriously, it listens on every network interface so is visible from network unless you have a firewall installed.)

`HiddenServiceDir` can be _anywhere_, but usually it’s best to keep it under the folder your Tor daemon stores its data, i.e. `/var/lib/tor` if you install tor daemon from your distribution’s package manager.

Pointing HiddenServicePort to a UNIX socket is a bit more advanced. Some web servers (like NGINX) can listen on a UNIX socket (a “file”, so to speak) instead of on a port. Instead of anyone that can reach you through network, now only the programs on your computer can reach this website (your Onion service). If you configure NGINX to listen on `/run/nginx-website.sock`, you should have `HiddenServicePort 80 unix:/run/nginx-website.sock` in your torrc.

---

<div class="post-metadata">

### Author: ![EatYourSprinkles](https://forum.torproject.org/user_avatar/forum.torproject.org/eatyoursprinkles/32/9024_2.png) [@EatYourSprinkles](https://forum.torproject.org/u/EatYourSprinkles)
#### Post date: [August 6, 2026, 11:53am UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/3 "2026-08-06T11:53:48Z")

</div>

Maybe I didn’t explain myself well.

I am aware that 'HiddenServiceDir" can be anything, but please look at these

> You will need to add the following two lines to your `torrc` file:
> 
> ```auto
> HiddenServiceDir /var/lib/tor/my_website/
> HiddenServicePort 80 127.0.0.1:80
> 
> ```

AND

> **Tip:** A good practice to avoid leaking an Onion Service to a local network is to run Onion Services over Unix sockets instead of a TCP socket. You will need to add the following two lines to your `torrc` file:
> 
> ```auto
> HiddenServiceDir /var/lib/tor/my-website/
> HiddenServicePort 80 unix:/var/run/tor/my-website.sock
> 
> ```

You can see that the first has my\_website

While the second has my-website

While I am fully aware that these fields should be edited with what I call the website the first one is my UNDERSCORE website

The second is my DASH website

Now. I am autistic, so this may just be me being overly precise, but this confuses me greatly.

Are these two different websites? Are these the same website and they just accidentally written the example folder/name in a different way? Are they all supposed to be the same website or are we talking about different websites coexisting on the same device?

---

<div class="post-metadata">

### Author: ![Uribe](https://forum.torproject.org/letter_avatar_proxy/v4/letter/u/e19b73/32.png) [@Uribe](https://forum.torproject.org/u/Uribe)
#### Post date: [August 6, 2026, 8:23pm UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/4 "2026-08-06T20:23:39Z")

</div>

It just shows two ways to setup your hidden service, with either a port/TCP socket or a file/Unix socket. If it helps your autistic thinking, think of it as the same site, just two different ways to do it.

> [@EatYourSprinkles](#):
>
> If the name I use is onion, should the part about leaking prevention also be onion or should it be something else?

This makes me think you believe the socket snippet from the documentation page you linked to be meant to be used in addition to the port one. You pick either one, not both at the same time.

The key word in the paragraph from the documentation is instead:

> A good practice to avoid leaking an Onion Service to a local network is to run Onion Services over Unix sockets instead of a TCP socket

The example should theoretically use the same name consistently, either underscore or dash.

---

<div class="post-metadata">

### Author: ![EatYourSprinkles](https://forum.torproject.org/user_avatar/forum.torproject.org/eatyoursprinkles/32/9024_2.png) [@EatYourSprinkles](https://forum.torproject.org/u/EatYourSprinkles)
#### Post date: [August 6, 2026, 10:21pm UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/5 "2026-08-06T22:21:57Z")

</div>

OH!

Thank you so much! I don’t know how I was lost in that part, I feel so silly right now but I am happy I finally get it!

You were very kind, I appreciate the time you took to help me out \<3

---

<div class="post-metadata">

### Author: ![system](https://forum.torproject.org/uploads/default/original/2X/d/d3424bed34f4ec18b2e99178c2801ba6dfb655d6.png) [@system](https://forum.torproject.org/u/system)
#### Post date: [August 8, 2026, 10:22pm UTC](https://forum.torproject.org/t/questions-about-leak-prevention/21928/6 "2026-08-08T22:22:57Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
