说明:性能较差,不太推荐,通过zfile上传的文件可以在系统中正常查看,在系统内创建的文件也会显示在zfile中,在zfile中无法看到磁盘使用情况,可以挂载其他网盘,默认不用登陆即可看到zfile内的文件
安装依赖环境

apt update
apt install openjdk-17-jre-headless unzip
#可用apt show查看可安装的openjdk版本

创建安装文件夹

mkdir -p /app/zfile

安装

下载地址https://github.com/zfile-dev/zfile/releases

cd /app/zfile
wget --no-check-certificate https://github.com/zfile-dev/zfile/releases/download/4.1.5/zfile-4.1.5.war
unzip zfile-*.war && rm -rf zfile-*.war
chmod +x ./bin/*.sh

修改端口

nano WEB-INF/classes/application.properties

守护进程命令

nano /etc/systemd/system/zfile.service

输入一下内容

[Unit]
Description=zfile
After=network.target
[Service]
Type=oneshot
ExecStart=/app/zfile/bin/start.sh
ExecStop=/app/zfile/bin/stop.sh
RemainAfterExit=yes
User=root
Group=root
[Install]
WantedBy=multi-user.target

开机启动

systemctl daemon-reload
systemctl enable zfile
systemctl start zfile

申请证书

#nginx -s stop
systemctl stop nginx
apt-get install socat curl cron
curl https://get.acme.sh | sh
~/.acme.sh/acme.sh --set-default-ca --server letsencrypt
~/.acme.sh/acme.sh --issue -d www.kkiikk.top --standalone -k ec-256 --force --test
rm -rf ~/.acme.sh/www.kkiikk.top_ecc
以上是测试
~/.acme.sh/acme.sh --issue -d www.kkiikk.top --standalone -k ec-256 --force
mkdir /etc/nginx/ssl/
~/.acme.sh/acme.sh --installcert -d www.kkiikk.top --fullchainpath /etc/nginx/ssl/www.kkiikk.top.crt --keypath /etc/nginx/ssl/www.kkiikk.top.key --ecc --force

配置nginx

nginx.conf配置

nano /etc/nginx/conf/nginx.conf 
#nano /etc/nginx/nginx.conf

编辑nginx.conf

user  root;
worker_processes  auto;
error_log  /etc/nginx/error.log warn;
pid        /run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/conf/mime.types; #注意路径,必须写,否则可能造成css无法加载
    #include       /etc/nginx/mime.types; #注意路径,必须写,否则可能造成css无法加载
    default_type  application/octet-stream;
    log_format  main  '\$remote_addr - \$remote_user [\$time_local] "\$request" '
                      '\$status \$body_bytes_sent "\$http_referer" '
                      '"\$http_user_agent" "\$http_x_forwarded_for"';
    access_log /etc/nginx/access.log main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  120;
    client_max_body_size 20m;
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
}

zfile.conf配置

nano /etc/nginx/conf.d/zfile.conf 

输入

server {
        listen 443 ssl;
        listen [::]:443 ssl; #没有ipv6的话要注释掉这行
        ssl_certificate       /etc/nginx/ssl/www.kkiikk.top.crt;
        ssl_certificate_key   /etc/nginx/ssl/www.kkiikk.top.key;
        ssl_protocols         TLSv1.3;
        ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+ECDSA+AES128:EECDH+aRSA+AES128:RSA+AES128:EECDH+ECDSA+AES256:EECDH+aRSA+AES256:RSA+AES256:EECDH+ECDSA+3DES:EECDH+aRSA+3DES:RSA+3DES:!MD5;
        server_name www.kkiikk.top;

        location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_pass http://127.0.0.1:端口;
        
        }
        #允许大文件上传
        client_max_body_size 0;
        # Config for 0-RTT in TLSv1.3
        ssl_early_data on;
        ssl_stapling on;
        ssl_stapling_verify on;
        proxy_set_header Early-Data $ssl_early_data;
        add_header Strict-Transport-Security "max-age=31536000";

}

server {
        listen 80;
        listen [::]:80;   #没有ipv6的话要注释掉这行
        server_name www.kkiikk.top;
        return 301 https://www.kkiikk.top$request_uri;
}

server {
        listen 80;
        listen [::]:80;   #没有ipv6的话要注释掉这行
        server_name kkiikk.top;
        return 301 https://www.kkiikk.top$request_uri;
}

设置存储权限

mkdir -p /html/网盘/zfile
chmod -R 777 /html/网盘/zfile

重启程序

systemctl restart nginx
systemctl restart zfile

第一次登陆时输入用户自己的用户名密码

最后修改:2024 年 09 月 24 日
如果觉得我的文章对你有用,请随意赞赏