PingvinShare是一个专注于分享文件的网盘程序,类似于市面上那些临时文件网盘,上传你要分享的文件,设置一个文件到期时间,提供一个下载地址,就是这样。
PingvinShare特性:
Share files using a link
Unlimited file size (restricted only by disk space)
Set an expiration date for shares
Secure shares with visitor limits and passwords
Email recipients
Integration with ClamAV for security scans
安装需要用到的软件包:
apt -y update apt -y install curl nginx python3-certbot-nginx curl -fsSL https://get.docker.com -o get-docker.sh sh get-docker.sh
新建目录、compose文件:
mkdir -p /opt/pingvin-share && cd /opt/pingvin-share && nano docker-compose.yml
写入如下配置:
version: '3.8' services: pingvin-share: image: stonith404/pingvin-share restart: unless-stopped ports: - 127.0.0.1:3100:3000 volumes: - "./data:/opt/app/backend/data" - "./data/images:/opt/app/frontend/public/img" depends_on: clamav: condition: service_healthy clamav: image: clamav/clamav restart: unless-stopped
[注意事项]
pingvinshare支持clamav反病毒,如果启用clamav,则每个上传的文件都会被clamav扫描,如果发现恶意文件则文件会被clamav自动删除。运行clamav需要用到的内存较多,如机器配置不够,可注释掉相关的配置。
配置nginx反向代理,新建nginx站点配置文件:
nano /etc/nginx/sites-available/pingvinshare
写入如下配置:
upstream pingvinshare { server 127.0.0.1:3100; } server { listen 80; listen [::]:80; server_name pingvinshare.example.com; location / { proxy_pass http://pingvinshare; proxy_set_header 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; proxy_set_header X-Forwarded-Protocol $scheme; client_max_body_size 0; } }
启用站点:
ln -s /etc/nginx/sites-available/pingvinshare /etc/nginx/sites-enabled/pingvinshare
申请tls证书:
certbot --nginx --email imlala@example.com --agree-tos --no-eff-email
访问域名,注册一个账号,第一个注册的用户将成为管理员。
[重要]登录管理员账户后,需要修改程序的URL地址为反向代理的域名:
测试一下clamav能否正常工作,新建一个txt文本文件,在里面写入EICAR测试文件的代码:
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
将这个txt文本文件上传到pingvinshare,如果正常的话,pingvinshare会提示共享已删除:
查看clamav的log应该也会有相应的信息: