https://github.com/elitah/vhost
vhost(write by golang),用于虚拟服务器反向代理(按域名进行反向代理),同时带有自动证书申请功能(Let's Encrypt提供,自动更新),支持直接自动申请证书反向代理HTTP页面,无需任何改变升级HTTP为HTTPS
https://github.com/elitah/vhost
golang vhost
Last synced: 5 months ago
JSON representation
vhost(write by golang),用于虚拟服务器反向代理(按域名进行反向代理),同时带有自动证书申请功能(Let's Encrypt提供,自动更新),支持直接自动申请证书反向代理HTTP页面,无需任何改变升级HTTP为HTTPS
- Host: GitHub
- URL: https://github.com/elitah/vhost
- Owner: elitah
- License: mit
- Created: 2019-09-18T02:52:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-01T07:18:40.000Z (almost 6 years ago)
- Last Synced: 2024-06-20T02:08:13.623Z (almost 2 years ago)
- Topics: golang, vhost
- Language: Go
- Homepage:
- Size: 131 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
vhost
---
vhost(write by golang)
如何使用
---
安装golang编译器,make工具
直接执行make即可
运行环境
---
目前仅测试Centos 7 x64
配置文件
---
目前不支持指定配置文件路径,请可执行程序目录下创建config.json,以下为参考配置:
规则如下:
- 当用户访问`http://example.com`跳转到`https://example.com`,模式为直接HTTP 302跳转
- 当用户访问`https://example.com`将启动TCP透传模式,将数据发送到127.0.0.1:18880,需要自行提供证书
- 当用户访问`http://www.example.com`跳转到`https://example.com`,模式为直接HTTP 302跳转
- 当用户访问`http://autocert.example.com`跳转到`https://autocert.example.com`,模式为直接HTTP 302跳转
- 当用户访问`https://autocert.example.com`将启动反向代理模式,自动申请证书,将HTTP页面升级到HTTPS
- 未指定的域名将匹配`*`规则
参数配置文件:
config.json
```
{
"http": 80,
"https": 443,
"domain": "统计页面入口域名,此域名不会转发",
"username": "统计页面授权用户名",
"password": "统计页面授权用户密码",
"list": {
"example.com": {
"http_to": "https://example.com",
"https_to": "127.0.0.1:18880"
},
"www.example.com": {
"http_to": "https://example.com"
},
"autocert.example.com": {
"http_to": "autocert://127.0.0.1:30080"
},
"*": {
"http_to": "127.0.0.1:30080",
"https_to": "127.0.0.1:30443"
}
}
}
```