NPS内网代理安装配置

官网地址:https://ehang-io.github.io/nps/#/

以下使用最简洁的方式

服务端

下载


复制后面下载链接地址
wget 下载地址

解压

tar -zxvf linux_amd64_server.tar.gz nps

安装

./nps install
安装后的目录在/etc/nps/

配置

cd /etc/nps/conf 
vim nps.conf

主要调整bridge和web的配置,bridge为客户端要连接的信息,web为页面管理需要的信息

appname = nps
#Boot mode(dev|pro)
runmode = dev

#HTTP(S) proxy port, no startup if empty
#http_proxy_ip=0.0.0.0
#http_proxy_port=8888
#https_proxy_port=8443
#https_just_proxy=true
#default https certificate setting
#https_default_cert_file=conf/server.pem
#https_default_key_file=conf/server.key

##bridge
bridge_type=tcp
bridge_port=7000
bridge_ip=0.0.0.0

# Public password, which clients can use to connect to the server
# After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file.
public_vkey=123

#Traffic data persistence interval(minute)
#Ignorance means no persistence
#flow_store_interval=1

# log level LevelEmergency->0  LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7
log_level=7
#log_path=nps.log

#Whether to restrict IP access, true or false or ignore
#ip_limit=true

#p2p
#p2p_ip=127.0.0.1
#p2p_port=6000

#web
web_host=c.o.com
web_username=admin
web_password=123
web_port =7001
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=conf/server.pem
web_key_file=conf/server.key
# if web under proxy use sub path. like http://host/nps need this.
#web_base_url=/nps

#Web API unauthenticated IP address(the len of auth_crypt_key must be 16)
#Remove comments if needed
#auth_key=test
auth_crypt_key =1234567812345678

#allow_ports=9001-9009,10001,11000-12000

#Web management multi-user login
allow_user_login=false
allow_user_register=false
allow_user_change_username=false


#extension
allow_flow_limit=false
allow_rate_limit=false
allow_tunnel_num_limit=false
allow_local_proxy=false
allow_connection_num_limit=false
allow_multi_ip=false
system_info_display=false

#cache
http_cache=false
http_cache_length=100

#get origin ip
http_add_origin_header=false

#pprof debug options
#pprof_ip=0.0.0.0
#pprof_port=9999

#client disconnect timeout
disconnect_timeout=60

启动

nps start

#重启
nps restart
#停止
nps stop

web管理

访问ip:web端口,输入用户名和密码,都是上面配置文件中配置的
添加客户端,在添加隧道即可

客户端

下载

同服务端,使用client的下载链接

解压

tar -zxvf linux_amd64_client.tar.gz npc

配置

客户端的启配置有两种方式
1.在服务端的web管理界面中配置
在服务器的web界面中进行配置,参考官方文档
2.使用客户端配置文件,启动时指定该配置文件
这里不赘述,需要时参考官方文档

启动

启动也有两种方式
1.不使用本地配置文件
./npc -server=服务器IP:7000 -vkey=n0is4nfoh3gt9e8r -type=tcp
2.使用本地配置文件
./npc -config=./conf/npc.conf

安装服务

对于linux、darwin

注册:sudo ./npc install 其他参数(例如-server=xx -vkey=xx或者-config=xxx)
启动:sudo npc start
停止:sudo npc stop
如果需要更换命令内容需要先卸载./npc uninstall,再重新注册
对于windows,使用管理员身份运行cmd

注册:npc.exe install 其他参数(例如-server=xx -vkey=xx或者-config=xxx)
启动:npc.exe start
停止:npc.exe stop
如果需要更换命令内容需要先卸载npc.exe uninstall,再重新注册
如果需要当客户端退出时自动重启客户端,请按照如图所示配置 image
注册到服务后,日志文件windows位于当前目录下,linux和darwin位于/var/log/npc.log

posted @ 2025-04-30 11:34  fortuneju  阅读(366)  评论(0)    收藏  举报