nginx/discourse.conf 편집 방법
컨테이너 내부의 discourse.conf에 대한 변경 사항은 재빌드를 수행하면 어쨌든 되돌려진다고 가정합니다.
변경 사항을 유지하려면 컨테이너 설정(예: web_only.yml)에 해당 내용을 어떻게든 추가해야 합니다:
# […]
## 참고: 이는 YAML 문법입니다 - 이름이 있는 블록은 하나만 가질 수 있습니다
run:
- exec: echo "Beginning of custom commands"
# […]
- replace:
filename: /etc/nginx/conf.d/discourse.conf
from: $proxy_add_x_forwarded_for
to: $http_x_real_ip
global: true
# […]
서브폴더 Discourse 설치 디버깅 방법
Discourse 서브폴더 설치에서 Discourse 호출은 다음과 같이 이루어집니다:
example.org/forum → [example.org용 외부 프록시] → /path-to-discourse/discourse/shared/web-only/nginx.http.sock → [Discourse 웹 컨테이너 내 Nginx]
따라서 오류가 발생하면 먼저 오류 위치를 파악해야 합니다:
- 외부 프록시
- Discourse 컨테이너 내 Nginx
- Discourse 자체
외부 프록시
- 브라우저에서 호출하여 결과를 확인합니다.
- 외부 프록시의 오류 로그를 확인합니다.
Discourse 컨테이너 내 Nginx
- 웹서버에 SSH로 접속합니다.
curl을 사용하여 소켓에 직접 연결합니다.curl출력 및Nginx in Discourse의 로그를 디버깅합니다.
중요: http URL을 사용해야 하며 https를 사용해서는 안 됩니다.
curl -I --unix-socket /path-to-discourse/discourse/shared/web-only/nginx.http.sock http://www.example.org/forum/
이것이 작동하면 다음과 같은 실제 호출을 시도해 보세요:
curl --unix-socket /path-to-discourse/discourse/shared/web-only/nginx.http.sock \
-H "user-agent: Chrome/88.0.4324.182" \
-H "Accept-Encoding: gzip" \
http://www.example.org/forum/t/test-thread/12345 --output test-encoded.html.gz