From c0888def506f0ca74d3499bb6941a8743f6a5206 Mon Sep 17 00:00:00 2001 From: rock2dust Date: Tue, 18 Oct 2022 05:30:30 +0800 Subject: [PATCH] Update reverse-proxies.zh-cn.md (#21484) add proxy header to nginx config example ``` proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; ``` Signed-off-by: rock2dust Signed-off-by: rock2dust Co-authored-by: Lunny Xiao --- docs/content/doc/usage/reverse-proxies.zh-cn.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/content/doc/usage/reverse-proxies.zh-cn.md b/docs/content/doc/usage/reverse-proxies.zh-cn.md index 722b9c7c9db..f6d92e2a610 100644 --- a/docs/content/doc/usage/reverse-proxies.zh-cn.md +++ b/docs/content/doc/usage/reverse-proxies.zh-cn.md @@ -13,6 +13,12 @@ menu: identifier: "reverse-proxies" --- +# 反向代理 + +**目录** + +{{< toc >}} + ## 使用 Nginx 作为反向代理服务 如果您想使用 Nginx 作为 Gitea 的反向代理服务,您可以参照以下 `nginx.conf` 配置中 `server` 的 `http` 部分: @@ -24,6 +30,10 @@ server { location / { proxy_pass http://localhost:3000; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } ``` @@ -41,6 +51,10 @@ server { location /git/ { # 注意: 反向代理后端 URL 的最后需要有一个路径符号 proxy_pass http://localhost:3000/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } ```