wangbin
  • wangbin
  • 2019-05-26
  • IT

百度网盘下载利器BaiduPCS-Go带web版:baidupcs-web

一. 简介

BaiduPCS-Go只提供了命令行的交互方式,今天介绍个基于它开发的baidupcs-web,提供了web的交互方式.

二. 项目地址

https://github.com/liuzhuoling2011/baidupcs-web

三. 安装

到releases页面,下载BaiduPCS-Go-3.6.7-linux-amd64.zip

https://github.com/liuzhuoling2011/baidupcs-web/releases

install_baidupcs.sh

cd ~
wget https://github.com/liuzhuoling2011/baidupcs-web/releases/download/3.6.7/BaiduPCS-Go-3.6.7-linux-amd64.zip
unzip BaiduPCS-Go-3.6.7-linux-amd64.zip 
mv BaiduPCS-Go-3.6.7-linux-amd64 /usr/local/baidupcs-go
mv /usr/local/baidupcs-go/BaiduPCS-Go /usr/local/baidupcs-go/baidupcs-go
chmod a+x /usr/local/baidupcs-go/baiducps-go

# 删除文件
rm -f ~/BaiduPCS-Go-*-linux-amd64.zip 

四. 使用

启动命令

/usr/local/baidupcs-go/baiducps-go

提示

打开浏览器, 输入 http://localhost:5299 查看效果

启动成功,在5299端口提供了web服务.

五. nginx配置

# baidupcs.siyou325.com
server {

    listen       81;
    listen       [::]:81;
    listen       50443 ssl http2;
    listen       [::]:50443 ssl http2;

    server_name  baidupcs.siyou325.com;

    # ssl
    ssl_certificate             /vps/save/certificate/acme/*.siyou325.com/fullchain.cer;
    ssl_certificate_key         /vps/save/certificate/acme/*.siyou325.com/*.siyou325.com.key;
    ssl_trusted_certificate     /vps/save/certificate/acme/*.siyou325.com/fullchain.cer;

    # ecc
    ssl_certificate             /vps/save/certificate/acme/*.siyou325.com_ecc/fullchain.cer;
    ssl_certificate_key         /vps/save/certificate/acme/*.siyou325.com_ecc/*.siyou325.com.key;

    # Basic HTTP authentication
    auth_basic                  "nginx basic http authentication for files.siyou325.com";
    auth_basic_user_file        /vps/save/certificate/htpasswd/http-htpasswd;

    # log
    access_log                  logs/siyou325.com/baidupcs.siyou325.com/access-baidupcs.siyou325.com.log siyou325;
    error_log                   logs/siyou325.com/baidupcs.siyou325.com/error.log;

    # svn上传文件最大50m
    client_max_body_size 50m; 

    location /ws {
        proxy_redirect off;
        proxy_pass http://127.0.0.1:5299;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
    }

    location / {
        proxy_pass http://127.0.0.1:5299;
        proxy_set_header Host $host;
        proxy_set_header X-Real-Host $host;
        proxy_set_header X-Real-Ip $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # 禁止访问.svn目录,防止svn信息泄漏,必加项
    location ~ ^(.*)\/\.svn\/ {
        deny all;
    }

}

六. supervisor配置

[program:baidupcs-go]
command=/usr/local/baidupcs-go/baidupcs-go
directory=/usr/local/baidupcs-go/
user=nobody
user=nobody
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/vps/save/logs/supervisor/baidupcs.log
stderr_logfile=/vps/save/logs/supervisor/baidupcs-err.log

七. 结尾

好了,愉快得在web页上用百度账号登录,查看、下载自己网盘上的文件吧.

参考:

  1. https://github.com/liuzhuoling2011/baidupcs-web