NKC-Reverse-Proxy is a powerful and efficient cross-platform reverse proxy service written in Golang, with Let's Encrypt support.
You can install NKC-Reverse-Proxy by compiling the source code or downloading the pre-compiled binary.
git clone https://github.com/kccd/nkc-reverse-proxy
cd nkc-reverse-proxy
go build .
Download the binary for your OS from the releases page.
To run NKC-Reverse-Proxy, use the following command in your terminal:
nkc-reverse-proxy -f /path/to/config/file
Please note that the name of the executable file may vary depending on the platform you are using. Make sure to use the correct name of the executable file for your platform when running the program.
Replace /path/to/config/file with the path to your configuration file. This command will start the reverse proxy server and load the configuration file specified.
Used to control the display of console logs.
yaml
console:
debug: false # Whether to display debug logs
warning: false # Whether to display warning logs
error: false # Whether to display error logs
info: false # Whether to display info logs
When the program is behind another proxy program, this value must be set to obtain the real IP and Port of the client.
yaml
proxy: false # Whether to process after other proxy programs
maxIpCount: 1 # Maximum number of allowed IPs
For example, if the program is in the following scenario: Proxy1 -> Proxy2 -> Current program, to obtain the real IP and Port of the client, the following configuration needs to be done:
yaml
proxy: true
maxIpCount: 2
Access rate control.
yaml
req_limit:
- "50/10s 100" # Maximum of 50 requests processed in 10 seconds, with a cache of up to 100 requests, and no discrimination
- "200/5m 400 ip" # Maximum of 200 requests processed in 5 minutes, with a cache of up to 400 requests, restricted by client IP
Valid time units are: s
m
h
d
.
For example, if the request limit is not exceeding 500 per minute and the maximum cache number is 2000, restricted by client IP:
yaml
req_limit:
- "500/1m 2000 ip"
Used to configure the relevant information of the reverse proxy service.
For detailed configuration information, please refer to config.yaml
yaml
servers:
-
listen: 80
name:
- www.example.com
location:
-
reg: "^\\/"
pass:
- http://127.0.0.1:8080
balance: random
yaml
servers:
-
listen: 80
name:
- www.example.com
- example.com
location:
-
reg: "^\\/"
redirect_code: 301
redirect_url: "https://www.example.com"
-
listen: 443
name:
- www.example.com
ssl_cert: "/path/to/ssl/cert"
ssl_key: "/path/to/ssl/key"
location:
-
reg: "^\\/"
pass:
- http://127.0.0.1:9000
- http://127.0.0.1:9001
- http://127.0.0.1:9002
- http://127.0.0.1:9003
balance: random
yaml
servers:
-
listen: 80
name:
- www.example.com
- example.com
location:
-
reg: "^\\/"
redirect_code: 301
redirect_url: "https://www.example.com"
-
listen: 443
name:
- www.example.com
ssl_cert: "/path/to/ssl/cert"
ssl_key: "/path/to/ssl/key"
location:
-
reg: "^\\/"
pass:
- http://127.0.0.1:9000
- http://127.0.0.1:9001
- http://127.0.0.1:9002
- http://127.0.0.1:9003
balance: random
-
reg: "^\\/socket.io\\/"
pass:
- http://127.0.0.1:12000
- http://127.0.0.1:12001
- http://127.0.0.1:12002
- http://127.0.0.1:12003
balance: ip_hash
NKC-Reverse-Proxy is released under the GNU Lesser General Public License v3.0. This license grants you the freedom to use, modify, and distribute the software as you wish, subject to certain conditions.