feat(文档): 添加nginx反向代理

pull/534/merge
mack-a 2022-03-28 16:04:30 +08:00
parent 0ec73b3137
commit 3ca0885e5c
1 changed files with 43 additions and 0 deletions

View File

@ -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/;
}
}
```