mirror of
https://gitee.com/bookshelfplus/bookshelfplus
synced 2025-09-01 22:53:29 +08:00
配置nginx.conf,添加bat脚本
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"NODE_ENV": "development",
|
||||
"api": {
|
||||
"prefix": "http://127.0.0.1:8090/"
|
||||
"prefix": "http://localhost/api"
|
||||
},
|
||||
"title": "张小弟之家电子书分享(测试中)",
|
||||
"footer": {
|
||||
|
@@ -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;
|
||||
|
7
server/关闭nginx.bat
Normal file
7
server/关闭nginx.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
|
||||
cd .\nginx\
|
||||
nginx -s quit
|
||||
|
||||
echo <20>رճɹ<D5B3>
|
||||
pause
|
7
server/启动nginx.bat
Normal file
7
server/启动nginx.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
|
||||
cd .\nginx\
|
||||
start nginx.exe
|
||||
|
||||
echo <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
||||
pause
|
5
server/杀掉nginx进程.bat
Normal file
5
server/杀掉nginx进程.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
|
||||
taskkill /f /t /im nginx.exe
|
||||
|
||||
pause
|
7
server/重启nginx.bat
Normal file
7
server/重启nginx.bat
Normal file
@@ -0,0 +1,7 @@
|
||||
@echo off
|
||||
|
||||
cd nginx
|
||||
nginx -s reload
|
||||
|
||||
echo <20><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
||||
pause
|
Reference in New Issue
Block a user