栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

搭建内网穿透NPS

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

搭建内网穿透NPS

NPS方便调试,比如调试微信api的开发
下载地址:https://github.com/ehang-io/nps/releases


先安装服务端,注意nps服务端启动会占用80,8080,8024端口,所以我用nginx代理通过域名访问

# tar xzvf linux_amd64_server.tar.gz 
# ./nps install
# nps start  

参考配置

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=70
https_proxy_port=7443
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=8024
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=a.o.com
web_username=admin #访问的账号
web_password=123456 #访问的密码
web_port = 8080
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

查看版本

[root@iZ94l4vzimfZ ]#  nps --version
Version: 0.26.8
Core version: 0.26.0
Same core version of client and server can connect each other

启动后,可访问http://服务器ip:8080/index/

登录成功后,这个客户端连接端口很重要,记得开启防火墙放行这个端口,端口可以自行修改

新增客户端


配置主机

安装客户端,如果是windows的直接解压 双击npc.exe
客户端的配置

[common]

server_addr=服务器ip:8024 #服务器ip和端口,记得防火墙放行
conn_type=tcp
vkey=q5d8z7nb  #需要和服务器端添加客户端的的验证密钥一致

auto_reconnection=true
max_conn=1000
flow_limit=1000
rate_limit=1000
crypt=true
compress=true
disconnect_timeout=60

配置域名指向到你的服务器,然后这里添加主机和目标ip端口即可,客户端一旦启动就会在线状态,需要注意的是 你内网的ip和端口不能错,不然访问不了

客户端启动后出现以下信息,表示启动成功,这样你就可以进行域名调试本地服务了

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/868133.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号