# Tor를 통한 Discourse 포럼용 Nginx 설정

**URL:** https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750
**Category:** Self-hosting
**Created:** [12월 21, 2019, 1:18오전 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750 "2019-12-21T01:18:57Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![prostasia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prostasia/32/147385_2.png) [@prostasia](https://meta.discourse.org/u/prostasia)
#### Post date: [12월 21, 2019, 1:18오전 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/1 "2019-12-21T01:18:57Z")

</div>

모두 안녕하세요,

nginx를 사용하여 Discourse를 Tor 은닉 서비스로 설정하고 싶습니다. 현재 nginx에서 시도 중인 구성은 다음과 같습니다(동작하지 않으며, “서버를 찾을 수 없음” 오류가 발생합니다):

```
server {
    listen unix:/var/run/nginx-onion.sock;
    server_name prostadqmwc6no3n.onion;
    location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

```

tor.conf 파일에는 다음과 같은 설정이 있습니다:

```
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 unix:/var/run/nginx-onion.sock

```

그리고 /var/lib/tor/hidden\_service 디렉터리에는 호스트네임 및 개인 키 파일이 있습니다. Tor는 실행 중입니다.

Discourse는 클리어웹에서 설치 및 정상적으로 작동하고 있으며, /var/discourse/shared/standalone/nginx.http.sock 파일도 존재합니다.

필요하다면 이 문제를 해결하기 위해 약 1시간 정도의 작업에 대해 비용을 지불할 의향이 있습니다(아마도 제가 너무 멍청하게 접근하고 있는 것 같아서, 그 이상 걸리지는 않을 것이라 생각합니다).

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [12월 21, 2019, 10:45오전 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/2 "2019-12-21T10:45:05Z")

</div>

[Template for serving through an .onion address with Docker](https://meta.discourse.org/t/template-for-serving-through-an-onion-address-with-docker/41536?u=pfaffman)? 링크를 확인해 보셨나요?

---

<div class="post-metadata">

### Author: ![prostasia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prostasia/32/147385_2.png) [@prostasia](https://meta.discourse.org/u/prostasia)
#### Post date: [12월 21, 2019, 5:08오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/3 "2019-12-21T17:08:00Z")

</div>

네, 하지만 솔직히 이게 뭔 말인지 도무지 모르겠어요. 제가 필요한 건 그냥 제대로 동작하는 nginx 설정뿐인데, 이 방식은 너무 복잡하게 느껴집니다.

---

<div class="post-metadata">

### Author: ![jughead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jughead/32/184261_2.png) [@jughead](https://meta.discourse.org/u/jughead)
#### Post date: [4월 21, 2020, 12:43오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/4 "2020-04-21T12:43:26Z")

</div>

해결 방법을 찾았나요?

그리고 .onion 주소에서 Discourse 자체를 토커(tor)로 어떻게 실행하셨나요? (Tor를 통해서만 접근 가능한 포럼을 만들고 싶습니다)

---

<div class="post-metadata">

### Author: ![prostasia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prostasia/32/147385_2.png) [@prostasia](https://meta.discourse.org/u/prostasia)
#### Post date: [4월 21, 2020, 6:14오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/5 "2020-04-21T18:14:08Z")

</div>

네, 정상 작동하는 설정입니다. 문제는 꽤 단순했는데, 처음에는 소켓을 사용해 사이트를 서빙하려 했지만 작동하지 않아 결국 포트를 사용해야 했습니다.

```
server {
    listen 801;
    server_name 127.0.0.1;
   location / {
        proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

```

---

<div class="post-metadata">

### Author: ![jughead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jughead/32/184261_2.png) [@jughead](https://meta.discourse.org/u/jughead)
#### Post date: [4월 22, 2020, 8:44오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/6 "2020-04-22T20:44:40Z")

</div>

빠른 답변 감사합니다!

한 가지 더 질문이 있는데요. 서버 사양은 어떻게 되나요(사용자 규모 기준)? / Tor를 통한 성능 향상을 위해 어떤 변경 사항을 적용했나요?

미리 감사드립니다!

---

<div class="post-metadata">

### Author: ![prostasia](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/prostasia/32/147385_2.png) [@prostasia](https://meta.discourse.org/u/prostasia)
#### Post date: [4월 22, 2020, 9:23오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/7 "2020-04-22T21:23:02Z")

</div>

2GB Digital Ocean VM에 105명의 사용자가 접속하고 있습니다. 우리는 어떤 수정도 하지 않았습니다 (tor와 clearweb을 동시에 제공하도록 허용하는 플러그인 설치 제외).

---

<div class="post-metadata">

### Author: ![jughead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jughead/32/184261_2.png) [@jughead](https://meta.discourse.org/u/jughead)
#### Post date: [5월 30, 2020, 1:02오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/8 "2020-05-30T13:02:11Z")

</div>

또 다른 질문인데, 사용자 이미지(배경 카드, 프로필 배너 등)가 로딩되는 데 정말 오래 걸리는 문제가 있나요? (이건 tor 때문인 것 같습니다.) 일단 캐싱이 되면 정상적으로 잘 표시되긴 합니다.

---

<div class="post-metadata">

### Author: ![jughead](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jughead/32/184261_2.png) [@jughead](https://meta.discourse.org/u/jughead)
#### Post date: [6월 12, 2020, 9:40오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/9 "2020-06-12T21:40:21Z")

</div>

Tor 사용자 주소가 어떻게 작동하는지 정확히 알지 못합니다. 제 경우 모든 로그인한 사용자의 IP가 127.0.0.1로 표시되는데, 이는 예상대로이지만 nginx에서 x-forwarded-for 헤더를 설정해 두었습니다.

Tor 네트워크 자체에서 Tor 사용자에게 IP와 유사한 것이 있는지, 그리고 이를 어떻게 표시할 수 있는지 확실하지 않습니다.

---

<div class="post-metadata">

### Author: ![rollerbob](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rollerbob/32/159397_2.png) [@rollerbob](https://meta.discourse.org/u/rollerbob)
#### Post date: [6월 12, 2020, 10:09오후 UTC](https://meta.discourse.org/t/nginx-configuration-for-discourse-forum-over-tor/136750/10 "2020-06-12T22:09:38Z")

</div>

[set\_real\_ip\_from](https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from)을 사용해야 할 수도 있습니다
