> For the complete documentation index, see [llms.txt](https://overleaf-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://overleaf-pro.ayaka.space/on-premises/on-premises-cs/konfigurace/overleaf-toolkit/tls-proxy.md).

# TLS proxy

Volitelný TLS proxy pro ukončování HTTPS připojení pomocí NGINX.

Spusťte `bin/init --tls` pro inicializaci místní konfigurace s konfigurací proxy NGINX nebo pro přidání konfigurace proxy NGINX k existující místní konfiguraci. A **ukázkový** soukromý klíč je vytvořen v `config/nginx/certs/overleaf_key.pem` a **falešný** certifikát v `config/nginx/certs/overleaf_certificate.pem`. Buď je nahraďte svým skutečným soukromým klíčem a certifikátem, nebo nastavte hodnoty `TLS_PRIVATE_KEY_PATH` a `TLS_CERTIFICATE_PATH` proměnných na cesty ke skutečnému soukromému klíči a certifikátu.

Výchozí konfigurace pro NGINX je uvedena v `config/nginx/nginx.conf` kterou lze přizpůsobit podle vašich požadavků. Cesta ke konfiguračnímu souboru lze změnit pomocí `NGINX_CONFIG_PATH` proměnné.

{% hint style="success" %}
Pokud máte **docker-compose.yml** nasazení založené na, nebo spravujete vlastní reverzní proxy NGINX, můžete si zobrazit ukázkový **nginx.conf** soubor [zde](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/nginx.conf).
{% endhint %}

Přidejte do svého následující sekci `config/overleaf.rc` souboru, pokud tam již není:

```
# Konfigurace TLS proxy (volitelné)
NGINX_ENABLED=false
NGINX_CONFIG_PATH=config/nginx/nginx.conf
NGINX_HTTP_PORT=80

# Nahraďte tyto IP adresy externí IP adresou vašeho hostitele
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" %}
Pokud používáte externí TLS proxy (tj. není spravována Overleaf Toolkitem), ujistěte se, že `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<ip-of-your-tls-proxy>` je nastaveno ve vašem `config/variables.env`, např. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`.
{% endhint %}

{% hint style="danger" %}
Pokud používáte podsíť z `172.16.0.0/12` (výchozí podsíť pro sítě Dockeru) pro vaši místní síť, budete muset nastavit `OVERLEAF_TRUSTED_PROXY_IPS=loopback,<network>` ve vašem `config/variables.env`. Kde `<network>` je `IPAM -> Config -> Subnet` hodnota v `docker inspect overleaf_default`, např. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16`. To má zabránit spoofování `X-Forwarded` hlavičky.
{% endhint %}

{% hint style="info" %}
Pokud `OVERLEAF_TRUSTED_PROXY_IPS` není nastaveno ručně, výchozí hodnota je `loopback`. Při ručním nastavení musíte zajistit, že zahrnete jednu z `loopback`, `localhost` nebo `127.0.0.1`, která důvěřuje **nginx** instanci běžící uvnitř **sharelatex** kontejneru.
{% endhint %}

Chcete-li spustit proxy, změňte hodnotu `NGINX_ENABLED` proměnné v `config/overleaf.rc` od `false` na `true` a spusťte znovu `bin/up`.

Ve výchozím nastavení bude webové rozhraní HTTPS dostupné na `https://127.0.1.1:443`. Připojení k `http://127.0.1.1:80` budou přesměrována na `https://127.0.1.1:443`. Chcete-li změnit IP adresu, na které NGINX naslouchá, nastavte `NGINX_HTTP_LISTEN_IP` a `NGINX_TLS_LISTEN_IP` proměnné. Porty lze změnit pomocí `NGINX_HTTP_PORT` a `TLS_PORT` proměnných.

Pokud se NGINX nepodaří spustit s chybovou zprávou `Error starting userland proxy: listen tcp4 ... bind: address already in use` ujistěte se, že `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` se nepřekrývá s `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.

{% @mermaid/diagram content="sequenceDiagram
participant user as User
participant external as Host External
participant internal as Host Internal
participant nginx as nginx
participant sharelatex as sharelatex
participant git-bridge as git-bridge
%% User connects to external host 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
%% User connects to external host 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
%% User connects to localhost HTTP
user->>+ internal: HTTP
note over internal: OVERLEAF\_LISTEN\_IP:OVERLEAF\_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
%% sharelatex connects to 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://overleaf-pro.ayaka.space/on-premises/on-premises-cs/konfigurace/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.
