> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/ko/configuration/overleaf-toolkit/tls-proxy.md).

# TLS 프록시

NGINX를 사용하여 HTTPS 연결을 종료하기 위한 선택적 TLS 프록시입니다.

실행 `bin/init --tls` 를 사용하여 NGINX 프록시 구성으로 로컬 구성을 초기화하거나, 기존 로컬 구성에 NGINX 프록시 구성을 추가합니다. A **예시** 개인 키가 다음 위치에 생성됩니다 `config/nginx/certs/overleaf_key.pem` 그리고 **더미** 인증서가 다음 위치에 있습니다 `config/nginx/certs/overleaf_certificate.pem`. 이 파일들을 실제 개인 키와 인증서로 교체하거나, 다음 변수의 값을 `TLS_PRIVATE_KEY_PATH` 및 `TLS_CERTIFICATE_PATH` 를 각각 실제 개인 키와 인증서의 경로로 설정하세요.

NGINX에 대한 기본 구성이 다음에 제공됩니다 `config/nginx/nginx.conf` 필요에 맞게 사용자 지정할 수 있습니다. 구성 파일의 경로는 다음 변수로 변경할 수 있습니다. `NGINX_CONFIG_PATH` 변수.

{% hint style="success" %}
다음이 있는 경우 **docker-compose.yml** 기반 배포를 사용하거나 직접 NGINX 리버스 프록시를 관리하는 경우, 예시를 볼 수 있습니다 **nginx.conf** 파일 [여기](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/nginx.conf).
{% endhint %}

다음 섹션을 `config/overleaf.rc` 파일에 이미 없으면 추가하세요:

```
# TLS 프록시 구성(선택 사항)
NGINX_ENABLED=false
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=80

# 호스트의 외부 IP 주소로 이 IP 주소들을 바꾸세요
NGINX_HTTP_LISTEN_IP=127.0.1.1 
NGINX_TLS_LISTEN_IP=127.0.1.1
TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem
TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem
TLS_PORT=443
```

{% hint style="danger" %}
외부 TLS 프록시(즉, Overleaf Toolkit에서 관리하지 않는 프록시)를 사용하는 경우, 다음이 `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<ip-of-your-tls-proxy>` 가 다음에 설정되어 있는지 확인하세요 `config/variables.env`, 예: `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`.
{% endhint %}

{% hint style="danger" %}
다음의 서브넷을 사용하는 경우 `172.16.0.0/12` (Docker 네트워크의 기본 서브넷) 로컬 네트워크에 대해, 다음을 설정해야 합니다 `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<network>` 를 다음에 `config/variables.env`. 여기서 `<network>` 는 다음입니다 `IPAM -> Config -> Subnet` 값 `docker inspect overleaf_default`, 예: `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16`. 이는 다음의 스푸핑을 방지하기 위한 것입니다 `X-Forwarded` 헤더.
{% endhint %}

{% hint style="info" %}
만약 `OVERLEAF_TRUSTED_PROXY_IPS` 가 수동으로 설정되지 않으면 기본값은 `loopback`입니다. 수동으로 설정하는 경우, 다음 중 하나를 포함해야 합니다 `loopback`, `localhost` 또는 `127.0.0.1`, 이는 다음을 신뢰합니다 **nginx** 인스턴스가 다음 내부에서 실행 중인 **sharelatex** 컨테이너.
{% endhint %}

신뢰할 수 있는 프록시 IP를 올바르게 구성했다면, 다음에서 공용 IP 주소가 보여야 합니다 `/user/sessions` 페이지처럼 다음과 같이:

<figure><img src="/files/65ae524fedfd80c6ebbb835ce273b97f345a04e1" alt="" width="375"><figcaption></figcaption></figure>

위에 표시된 IP 주소가 여전히 다음과 같다면 `127.0.0.1` 또는 사설/로컬 네트워크 IP 주소라면, 신뢰할 수 있는 프록시 구성을 확인하세요. 특히 다음 값 `OVERLEAF_TRUSTED_PROXY_IPS`.

프록시를 실행하려면, 다음의 값을 변경하세요 `NGINX_ENABLED` 변수를 `config/overleaf.rc` 에서 `false` 로 `true` 변경하고 다시 실행하세요 `bin/up`.

기본적으로 HTTPS 웹 인터페이스는 다음에서 사용할 수 있습니다 `https://127.0.1.1:443`. 다음으로의 연결은 `http://127.0.1.1:80` 다음으로 리디렉션됩니다 `https://127.0.1.1:443`. NGINX가 수신하는 IP 주소를 변경하려면 다음을 설정하세요 `NGINX_HTTP_LISTEN_IP` 및 `NGINX_TLS_LISTEN_IP` 변수. 포트는 다음을 통해 변경할 수 있습니다 `NGINX_HTTP_PORT` 및 `TLS_PORT` 변수.

NGINX가 다음 오류 메시지와 함께 시작에 실패하면 `Error starting userland proxy: listen tcp4 ... bind: address already in use` 다음이 `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` 와 겹치지 않는지 확인하세요 `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.

```mermaid
sequenceDiagram
participant user as 사용자
participant external as 호스트 외부
participant internal as 호스트 내부
participant nginx as nginx
participant sharelatex as sharelatex
participant git-bridge as git-bridge
%% 사용자가 외부 호스트 HTTP에 연결
user->>+ external: HTTP
note over external: NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT
external->>+ nginx: HTTP
note over nginx: nginx:80
nginx-->>-external: 301
%% 사용자가 외부 호스트 HTTPS에 연결
user->>+ external: HTTPS
note over external: NGINX_TLS_LISTEN_IP:TLS_PORT
external->>+ nginx: HTTPS
note over nginx: nginx:443
nginx->>+ sharelatex: HTTP
note over sharelatex: sharlatex:80
%% 사용자가 localhost HTTP에 연결
user->>+ internal: HTTP
note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
%% sharelatex가 git-bridge에 연결
sharelatex->>+git-bridge: HTTP /git/
note over git-bridge: git-bridge:8000
note over sharelatex: GIT_BRIDGE_HOST:GIT_BRIDGE_PORT
git-bridge->>+sharelatex: WEB/WEB-API:3000
git-bridge->>+sharelatex: HISTORY-V1:3100
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/ko/configuration/overleaf-toolkit/tls-proxy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
