开发环境搭建
开发环境搭建
目标:
网络架构图
细分目标:
开发环境
需要和微信开发服务器连调
内网穿透「frp」
固定测试域名「nginx代理」
生产环境
生产服务器和正式服务器直接对接
系统放在生产服务器
nginx代理发布
测试环境和生产环境配置信息不同
设置不同的环境变量
配置过程:
测试服务器内网穿透和测试服务器nginx域名配置:http://www.rstone.com.cn/docs/other/frp
生产服务器:
nginx api.rstone.com.cn
server { listen 80; # 监听端口 server_name api.rstone.com.cn; # 域名 location / { proxy_pass http://172.19.0.1:8080/; # 代理目标地址 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; # 设置代理请求头 } }nginx admin.rstone.com.cn
server { listen 80; # 监听端口 server_name admin.rstone.com.cn; # 域名 location / { root /usr/share/nginx/html/hw.rstone.com.cn/admin; try_files $uri $uri/ @routerblog; index index.html index.htm; } location @routerblog{ rewrite ^.*$ /index.html last; } }
# 开发环境搭建
1. 目标:
- 网络架构图

- 细分目标:
- 开发环境
- 需要和微信开发服务器连调
- 内网穿透「frp」
- 固定测试域名「nginx代理」
- 生产环境
- 生产服务器和正式服务器直接对接
- 系统放在生产服务器
- nginx代理发布
- 测试环境和生产环境配置信息不同
- 设置不同的环境变量
2. 配置过程:
1. 测试服务器内网穿透和测试服务器nginx域名配置:[http://www.rstone.com.cn/docs/other/frp](http://www.rstone.com.cn/docs/other/frp)
2. 生产服务器:
- nginx api.rstone.com.cn
```nginx
server {
listen 80; # 监听端口
server_name api.rstone.com.cn; # 域名
location / {
proxy_pass http://172.19.0.1:8080/; # 代理目标地址
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; # 设置代理请求头
}
}
```
- nginx admin.rstone.com.cn
```nginx
server {
listen 80; # 监听端口
server_name admin.rstone.com.cn; # 域名
location / {
root /usr/share/nginx/html/hw.rstone.com.cn/admin;
try_files $uri $uri/ @routerblog;
index index.html index.htm;
}
location @routerblog{
rewrite ^.*$ /index.html last;
}
}
```