From 3ca0885e5c76f030d08ea4f9787d7fedba0727b3 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Mon, 28 Mar 2022 16:04:30 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=96=87=E6=A1=A3):=20=E6=B7=BB=E5=8A=A0n?= =?UTF-8?q?ginx=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- documents/nginx_proxy.md | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 documents/nginx_proxy.md diff --git a/documents/nginx_proxy.md b/documents/nginx_proxy.md new file mode 100644 index 0000000..4ead47f --- /dev/null +++ b/documents/nginx_proxy.md @@ -0,0 +1,43 @@ +# 1.打开Nginx配置文件 + +``` +vim /etc/nginx/conf.d/alone.conf +``` + +# 2.添加配置 + +- 如需配置HTTP1.1,找到31300端口所在的server【文件最后,非return 403那条】 +- 如需配置HTTP2.0,找到31302端口所在的server + +> 下方使用配置HTTP1.1反向代理作为示例 + +``` +# 如果要添加到根路由,则添加到localtion /下面 +location / { + add_header Strict-Transport-Security "max-age=15552000; preload" always; + proxy_pass http://127.0.0.1:3003/; +} + +# 如果只需要添加额外的路径,则额外写一个location,路径可自定义 +location /test { + proxy_pass http://127.0.0.1:3003/; +} + +# 完整配置,HTTP2.0则同理,写入到31302端口所在的server即可 +server { + listen 127.0.0.1:31300; + server_name xx; + root /usr/share/nginx/html; + location /s/ { + add_header Content-Type text/plain; + alias /etc/v2ray-agent/subscribe/; + } + location / { + add_header Strict-Transport-Security "max-age=15552000; preload" always; + proxy_pass http://127.0.0.1:3003/; + } + location /test { + proxy_pass http://127.0.0.1:3003/; + } +} +```