/ / 2 min read

Linux服务器搭建一个http节点

还是使用sing-box来搭建一个http节点,带密码或者不带密码的.
  1. 下载

    wget -q4O /usr/local/bin/ycycxz-sing-box https://ycycxz.com/dl/ycycxz-sing-box-linux-amd64
    chmod +x /usr/local/bin/ycycxz-sing-box
    mkdir -p /etc/ycycxz-sing-box
    ycycxz-sing-box version
  2. 配置

    端口 用户名 密码

    /etc/ycycxz-sing-box/ycycxz.json
    cat <<EOF > /etc/ycycxz-sing-box/ycycxz.json
    {
    "inbounds": [
    {
    "type": "http",
    "listen_port": 42324,
    "users": [
    {
    "username": "ycycxz",
    "password": "ycycxz"
    }
    ]
    }
    ]
    }
    EOF
  3. 无密码

    /etc/ycycxz-sing-box/ycycxz.json
    cat <<EOF > /etc/ycycxz-sing-box/ycycxz.json
    {
    "inbounds": [
    {
    "type": "http",
    "listen_port": 42324
    }
    ]
    }
    EOF
  4. systemd

    cat <<EOF > /etc/systemd/system/ycycxz-sing-box.service
    [Unit]
    Description=ycycxz-sing-box
    After=network-online.target
    [Service]
    LimitAS=infinity
    LimitNOFILE=infinity
    LimitNPROC=infinity
    TasksMax=infinity
    ExecStart=/usr/local/bin/ycycxz-sing-box run -c /etc/ycycxz-sing-box/ycycxz.json
    [Install]
    WantedBy=multi-user.target
    EOF
    systemctl daemon-reload
    systemctl enable ycycxz-sing-box
  5. 启动

    systemctl start ycycxz-sing-box
    #systemctl status ycycxz-sing-box
  6. 卸载

    systemctl stop ycycxz-sing-box
    rm /etc/systemd/system/ycycxz-sing-box.service
    systemctl daemon-reload
    rm -rf /etc/ycycxz-sing-box
    rm -f /usr/local/bin/ycycxz-sing-box
  7. 客户端

    用户名 密码 测试小火煎

  8. 视频教程