CentOS安装nps
该nps项目已经长久不更新了,并且存在一个身份验证的缺陷,无需登录,直接进后台,后台功能点全都可以用。所以不再建议使用。
该nps项目已经长久不更新了,并且存在一个身份验证的缺陷,无需登录,直接进后台,后台功能点全都可以用。所以不再建议使用。
源码地址 https://github.com/ehang-io/nps 说明文档 https://ehang.io/nps/documents
本次安装的版本是 v0.26.2
CentOS7 服务器IP 200.200.200.1
在 https://github.com/ehang-io/nps/releases 下载软件包 linux_amd64_server.tar.gz
- 创建目录
$ mkdir /opt/nps- 解压到目录
$ tar -zxf linux_amd64_server.tar.gz -C /opt/nps- 安装
$ cd /opt/nps$ ./nps install- 修改配置
配置文件位置 /etc/nps/conf,修改配置文件 nps.conf,如下:
appname = npsrunmode = pro
#bridgebridge_type=tcpbridge_port=8024bridge_ip=0.0.0.0log_level=7
#HTTP(S) proxy port, no startup if emptyhttp_proxy_ip=0.0.0.0http_proxy_port=https_proxy_port=https_just_proxy=true#default https certificate settinghttps_default_cert_file=conf/server.pemhttps_default_key_file=conf/server.key
#webweb_username=adminweb_password=123456web_port = 8080web_ip=0.0.0.0web_base_url=web_open_ssl=falseweb_cert_file=conf/server.pemweb_key_file=conf/server.key
allow_ports=8000-8200
#Web management multi-user loginallow_user_login=falseallow_user_register=falseallow_user_change_username=false
#extensionallow_flow_limit=falseallow_rate_limit=falseallow_tunnel_num_limit=falseallow_local_proxy=falseallow_connection_num_limit=falseallow_multi_ip=falsesystem_info_display=false
#cachehttp_cache=falsehttp_cache_length=100
#get origin iphttp_add_origin_header=false- 启动
$ sudo nps start之后就可以访问 http://200.200.200.1:8080/ 控制台,用户名和密码是配置文件的 web_username 和 web_password
- 其他命令
# 配置文件重载$ sudo nps reload
# 停止$ nps stop
# 重启$ nps restart
# 服务端更新$ nps-update updateCentOS7 服务器IP 192.168.1.225
在 https://github.com/ehang-io/nps/releases 下载软件包 linux_amd64_client.tar.gz
- 创建配置文件并填写配置文件
$ vim /etc/npc/npc.conf内容如下, vkey 填写的是创建客户端时填写的 客户端验证密钥
[common]server_addr=200.200.200.1:8024conn_type=tcpvkey=demotokenusername=adminpassword=123456compress=truecrypt=truerate_limit=10000flow_limit=100remark=t244max_conn=200auto_reconnection=true- 创建目录
$ mkdir /opt/npc- 解压到目录
$ tar -zxf linux_amd64_client.tar.gz -C /opt/npc- 安装
$ cd /opt/npc$ ./npc install -config=/etc/npc/npc.conf- 启动
$ sudo npc start- 其他命令
# 停止$ sudo npc stop
# 客户端更新$ sudo npc-update update- 修改配置
如果需要更换命令内容需要先卸载./npc uninstall,再重新安装
$ cd /opt/npc$ ./npc uninstall# 成功后再重新安装$ ./npc install -config=/etc/npc/npc.conf服务器要设置好开放的端口,建议 192.168.1.225 开放所有端口给 200.200.200.1。
$ firewall-cmd --permanent --zone=public --add-rich-rule=' rule family="ipv4" source address="200.200.200.1/32" accept';200.200.200.1 开放端口段,在控制台设置端口时使用开放段对应的端口。例如开放 nps.conf 设置的 allow_ports=8000-8200
$ firewall-cmd --zone=public --add-port=8000-8200/tcp --permanent