MENU

#源码#好用的JAVA云盘

December 2, 2022 • Read: 399 • 网站源码

最近想找一个onedrive目录云盘,发现了一个Java写的云盘程序,因为搭建起来很方便,所以记录一下,但是这个程序的易用性还是只是个人存储云盘,这个云盘还可以上FTP以及webDAV。存储方式还是蛮多的。

原github地址:

https://github.com/zfile-dev/docs

搭建文档原地址:

https://docs.zfile.vip/install-os/

如果大家没有储存,推荐一家日本的webDAV,速度很快。

https://teracloud.jp/en/ 注册会获得10G 输入邀请码:KS3NV 再获得5G 一共15G

开发文档已经写的很详细了,这里我简单记录一下。

开始

环境准备

  • VPS一台
  • SSH连接工具

搭建需要部署JAVA环境

Centos

yum install -y java-1.8.0-openjdk unzip

Ubuntu

apt update
apt install -y openjdk-8-jre-headless unzip

下载并解压

export ZFILE_INSTALL_PATH=~/zfile                        # 声明安装到的路径
mkdir -p $ZFILE_INSTALL_PATH && cd $ZFILE_INSTALL_PATH   # 创建文件夹并进入
wget --no-check-certificate https://c.jun6.net/ZFILE/zfile-release.war          # 下载 zfile 最新版
unzip zfile-release.war && rm -rf zfile-release.war      # 解压并删除压缩包
chmod +x $ZFILE_INSTALL_PATH/bin/*.sh                    # 授权启动停止脚本

启动项目

~/zfile/bin/start.sh       # 启动

启动后浏览器访问 http://ip:8080 即可,如启动后无法访问,请检查 端口是否冲突 或 防火墙/安全组是否开启。

简单检查方式为在服务器执行 curl http://127.0.0.1:8080

如返回 curl: (7) Failed connect to 127.0.0.1:8080; Connection refused 表示未启动成功。
如返回 <!DOCTYPE html> <html lang="zh-CN">…… 等字样表示启动成功,如启动成功但通过服务器 IP 无法访问,那一般就是防火墙/安全组未放行端口问题。

其他命令

以下为默认未修改安装路径下的情况,如修改了安装路径请自行更改命令所在路径。

~/zfile/bin/start.sh       # 启动
~/zfile/bin/stop.sh        # 停止

配置文件路径

~/zfile/WEB-INF/classes/application.properties

Nginx反代

在nginx的vhost的config文件中加入如下语句

location / { 
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_buffering off;
    proxy_set_header Host $http_host;

    proxy_pass http://127.0.0.1:8080;

      }
Archives QR Code Tip
QR Code for this page
Tipping QR Code