nps
nps
准备工作
目录准备
物理目录创建
mkdir -p /data/{downloads/shared,programfiles,opt} && \
mkdir -p /data/docker/dockercompose/{nps,}
持久化数据目录
rm -rf /volume1/docker/nps/{conf,ssl,temp,} && \
mkdir -p /volume1/docker/nps/{conf,ssl,temp,} && \
touch /volume1/docker/nps/conf/{clients.json,hosts.json,tasks.json} && \
ls -al /volume1/docker/nps
写入自定义配置文件
cat >/volume1/docker/nps/conf/nps.conf<<'EOF'
# nps.conf
appname = nps1
# Boot mode(dev|pro)
runmode = dev
# HTTP(S) proxy port, no startup if empty
http_proxy_ip=0.0.0.0
http_proxy_port=80
https_proxy_port=443
https_just_proxy=true
#default https certificate setting
https_default_cert_file=ssl/kinsong.cn.pem
https_default_key_file=ssl/kinsong.cn.key
## bridge
bridge_type=tcp
# bridge_port=8024
bridge_port=1234
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=UuM3nXsxLyW5du52xT#vwbKzve5YEP6M
# 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=kinsong.cn
web_username=user
web_password=password
web_port = 8080
web_ip=0.0.0.0
web_base_url=
web_open_ssl=false
web_cert_file=ssl/kinsong.cn.pem
web_key_file=ssl/kinsong.cn.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 =KtUNWLEG^6ySfuLc9aBpibBJqA#C58Gt
# 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
EOF
cat /volume1/docker/nps/conf/nps.conf
配置文件的含义
/etc/nps/conf/nps.conf
| 名称 | 含义 | 
|---|---|
| web_port | web管理端口 | 
| web_password | web界面管理密码 | 
| web_username | web界面管理账号 | 
| web_base_url | web管理主路径,用于将web管理置于代理子路径后面 | 
| bridge_port | 服务端客户端通信端口 | 
| https_proxy_port | 域名代理https代理监听端口 | 
| http_proxy_port | 域名代理http代理监听端口 | 
| auth_key | web api密钥 | 
| bridge_type | 客户端与服务端连接方式kcp或tcp | 
| public_vkey | 客户端以配置文件模式启动时的密钥,设置为空表示关闭客户端配置文件连接模式 | 
| ip_limit | 是否限制ip访问,true或false或忽略 | 
| flow_store_interval | 服务端流量数据持久化间隔,单位分钟,忽略表示不持久化 | 
| log_level | 日志输出级别 | 
| auth_crypt_key | 获取服务端authKey时的aes加密密钥,16位 | 
| p2p_ip | 服务端Ip,使用p2p模式必填 | 
| p2p_port | p2p模式开启的udp端口 | 
| pprof_ip | debug pprof 服务端ip | 
| pprof_port | debug pprof 端口 | 
| disconnect_timeout | 客户端连接超时,单位 5s,默认值 60,即 300s = 5mins | 
5. 容器正式创建
docker-compose
cat >/volume1/docker/dockercompose/nps/docker-compose.yml<<'EOF'
version: '3'
services:
  nps1:
    image: 'ffdfgdfg/nps:v0.26.10'
    container_name: nps1
    hostname: nps_1
    privileged: true
    restart: unless-stopped
    ports:
      - '55658:80/tcp'
      - '55659:443/tcp'
      - '55635:55635/tcp'
      - '55600:8080/tcp'
      - '53300-53400:53300-53400'
    volumes:
      - /volume1/docker/nps/conf:/conf
      - /volume1/docker/nps/ssl:/ssl
    environment:
      - TZ=Asia/Shanghai
    networks:
      bridge0:
        ipv4_address: 10.0.0.63
    dns:
      - 223.5.5.5
      - 114.114.114.114
networks:
  bridge0:
    external: true
EOF
cat /volume1/docker/dockercompose/nps/docker-compose.yml && \
cd /volume1/docker/dockercompose/nps
运行镜像
cd /volume1/docker/dockercompose/nps && \
docker-compose up -d && docker logs -f nps1
重启
cd /volume1/docker/dockercompose/nps && \
docker-compose restart && \
docker logs -f nps1
cd /volume1/docker/dockercompose/nps && \
docker-compose stop && \
docker-compose start && \
docker logs -f nps1
        本文链接:
        
              /archives/1691977434438
            
      
      
        版权声明:
        本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 
              kinsong的快乐小窝!
      
    喜欢就支持一下吧
      