1
0
mirror of https://gitee.com/bookshelfplus/bookshelfplus synced 2025-09-01 22:53:29 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

配置nginx.conf,添加bat脚本

This commit is contained in:
2022-03-13 20:55:12 +08:00
parent 9b6923acf1
commit e9d6107438
6 changed files with 59 additions and 3 deletions

View File

@@ -29,6 +29,14 @@ http {
#gzip on;
upstream frontendNodejsServer {
server 127.0.0.1:3000;
}
upstream backendSprintbootServer {
server 127.0.0.1:8090;
}
server {
listen 80;
server_name localhost;
@@ -37,12 +45,34 @@ http {
#access_log logs/host.access.log main;
location / {
root html;
proxy_pass http://frontendNodejsServer;
index index.html index.htm;
}
#error_page 404 /404.html;
location /api/ {
# Tomcat: 名字不可以出现 _
#只要用户在浏览器中访问的域名绑定了 VIP VIP 下面有RS则就用$host host是访问URL中的域名和端口 www.taobao.com:80
proxy_set_header Host $host;
#把源IP 【$remote_addr,建立HTTP连接header里面的信息】赋值给X-Real-IP;这样在代码中 $X-Real-IP来获取 源IP
proxy_set_header X-Real-IP $remote_addr;
# 在nginx 作为代理服务器时设置的IP列表会把经过的机器ip代理机器ip都记录下来用 【,】隔开;代码中用 echo $x-forwarded-for |awk -F, '{print $1}' 来作为源IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://backendSprintbootServer/;
index index.html index.htm;
}
# 查看 nginx 状态
# location /ngx_status {
# stub_status on;
# access_log off;
# #allow 127.0.0.1;
# #deny all;
# }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;