mirror of
https://github.com/ehang-io/nps
synced 2025-10-28 06:36:45 +08:00
Updated 使用教程 (markdown)
parent
42b451a692
commit
fcc2f276c7
91
使用教程.md
91
使用教程.md
|
|
@ -1,90 +1 @@
|
||||||
## 基础设施
|
.
|
||||||
- 一个域名
|
|
||||||
- 一台公网服务器(腾讯云、阿里云)
|
|
||||||
- 一台内网服务器(自己电脑或者其他)
|
|
||||||
|
|
||||||
## 教程
|
|
||||||
1. 域名配置
|
|
||||||
|
|
||||||
添加两条解析记录
|
|
||||||
> -server A 123.206.77.88
|
|
||||||
|
|
||||||
> *.server CNAME server.ourcauc.com.
|
|
||||||
|
|
||||||
项目 | 说明
|
|
||||||
---|---
|
|
||||||
server | 二级域名
|
|
||||||
ourcacu.com | 域名
|
|
||||||
server、*.server | 解析记录
|
|
||||||
A、CNAME | 记录类型
|
|
||||||
123.206.77.88 | 服务器ip地址
|
|
||||||
|
|
||||||
2. 服务器配置
|
|
||||||
- 安装nginx(较为简单,不再说明)
|
|
||||||
- 添加nginx服务器配置,配置如下,server_name请根据自己的实际情况修改
|
|
||||||
```
|
|
||||||
upstream nodejs {
|
|
||||||
server 127.0.0.1:8024;
|
|
||||||
keepalive 64;
|
|
||||||
}
|
|
||||||
server {
|
|
||||||
listen 80;
|
|
||||||
server_name *.server.ourcauc.com;
|
|
||||||
location / {
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header Host $http_host:8024;
|
|
||||||
proxy_set_header X-Nginx-Proxy true;
|
|
||||||
proxy_set_header Connection "";
|
|
||||||
proxy_pass http://nodejs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
3. 在服务端启动easyProxy
|
|
||||||
|
|
||||||
```
|
|
||||||
./easyProxy -mode server -vkey DKibZF5TXvic1g3kY -tcpport=8284 -httpport=8024
|
|
||||||
```
|
|
||||||
|
|
||||||
4. 在客户端建立配置文件,示例如下
|
|
||||||
|
|
||||||
```
|
|
||||||
{
|
|
||||||
"Server": {
|
|
||||||
"ip": "123.206.77.88",
|
|
||||||
"tcp": 8284,
|
|
||||||
"vkey": "DKibZF5TXvic1g3kY",
|
|
||||||
"num": 10
|
|
||||||
},
|
|
||||||
"SiteList": [
|
|
||||||
{
|
|
||||||
"host": "a.server.ourcauc.com",
|
|
||||||
"url": "10.1.50.203",
|
|
||||||
"port": 80
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"host": "b.server.ourcauc.com",
|
|
||||||
"url": "10.1.50.196",
|
|
||||||
"port": 4000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"Replace": 0
|
|
||||||
}
|
|
||||||
```
|
|
||||||
前面已经有说明
|
|
||||||
|
|
||||||
最后的效果,
|
|
||||||
|
|
||||||
访问a.server.ourcauc.com相当于访问10.1.50.203:80
|
|
||||||
|
|
||||||
访问b.server.ourcauc.com相当于访问10.1.50.196:4000
|
|
||||||
|
|
||||||
支持多站点
|
|
||||||
|
|
||||||
5. 客户端启动
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
./easyProxy -config config.json
|
|
||||||
```
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user