在远程服务器上搭建 ZeroNet

2016-09-07 2104点热度 0人点赞

ZeroNet 是一个利用比特币加密和 BT 技术提供不受审查的网络与通信的 BT 平台,由 Python 驱动。
项目地址:https://github.com/HelloZeroNet/ZeroNet

ZeroNet 以保密为基础,其上可以搭建去中心化的站点,吸引了很多人使用,软件 ShadowsocksRSS-C#版的发布地址就在 ZeroNet 上。

在各平台安装并使用 ZeroNet 也很方便,先安装 Python 环境,再到 ZeroNet 项目地址中下载对应的客户端,解压后就可以直接使用。

本人主要说明如何在远程服务器上搭建 ZeroNet,并可以正常访问(本例使用 CentOS)

搭建前,首先你要确认你的 ZeroNet 是否可以使用,方法是输入启动命令 python zeronet.py,启动完成后输入 Curl http://127.0.0.1:43110 这时候如果成功显示一串字母数字混合的代码则为启动成功。而后我们需要让他在后台启动

nohup sh ./ZeroNet.sh & > /tmp/zeronet.log

接下来我们需要配置 Nginx 让其担当代理功能(由于 http 不安全,我们直接使用 https,此处 SSL 相关不予叙述)

map $http_upgrade $connection_upgrade {
     default upgrade;
     '' close;
}
server {
  listen 443 ssl;
  listen [::]:443 ssl;
  server_name my.domain.name;
  ssl_certificate /website/userssl/ssl.crt;
  ssl_certificate_key /website/userssl/ssl.key;
  ssl_session_timeout 5m;
  access_log off;
  location / {
    proxy_pass http://127.0.0.1:43110;
    proxy_set_header Host $http_host;
  }

  location /Websocket {
    proxy_pass http://127.0.0.1:43110;
    proxy_set_header Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }

  if ($scheme = http) {
    return 301 https://$server_name$request_uri;
  }



}

配置完毕后重启 Nginx 服务,此时直接输入域名访问理论上没有任何问题,你可以用。


而如果你觉得直接输入域名就可以访问不太安全,那么我们可以为 ZeroNet 添加上密码

1 、开启加密功能

在 ZeroNet/plugins 文件夹中将 disabled-Uipassword 重命名为 Uipassword

2 、启动命令时添加额外参数

nohup sh ./ZeroNet.sh --ui_password YourPassword & > /tmp/zeronet.log


参考链接

WebSocket proxying [ 链接 ]

StarryVoid

Have a good time