Loading... > FileBrowser文档中caddy是v1版本,而此时caddy已经出了v2,文档中的方法并不适用caddy v2,故有了此教程,同时这个坑让我很悲伤!!!(不然怎么会有前面的blog ## 一、FileBrowser部署 ``` curl -fsSL https://filebrowser.org/get.sh | bash filebrowser -r /path/to/your/files ``` ## 二、caddy 反向代理+HTTPS 1. 安装caddy: ``` wget https://github.com/caddyserver/caddy/releases/download/v2.2.1/caddy_2.2.1_linux_amd64.tar.gz tar -zxvf caddy_2.2.1_linux_amd64.tar.gz mv caddy /usr/bin/ ``` 2. 测试是否安装成功: ``` caddy version ``` 3. 创建`caddy`用户组: ``` sudo groupadd --system caddy ``` 4. 添加`caddy`用户,并赋予对应的权限: ``` sudo useradd --system \ --gid caddy \ --create-home \ --home-dir /var/lib/caddy \ --shell /usr/sbin/nologin \ --comment "Caddy web server" \ caddy ``` 5. 编辑`caddy.service`配置文件: ``` vim /etc/systemd/system/caddy.service ``` ``` [Unit] Description=Caddy Documentation=https://caddyserver.com/docs/ After=network.target network-online.target Requires=network-online.target [Service] User=caddy Group=caddy ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile TimeoutStopSec=5s LimitNOFILE=1048576 LimitNPROC=512 PrivateTmp=true ProtectSystem=full AmbientCapabilities=CAP_NET_BIND_SERVICE [Install] WantedBy=multi-user.target ``` 6. 载入刚刚编辑的配置同时设置开机自启: ``` sudo systemctl daemon-reload sudo systemctl enable caddy ``` 7. 编辑caddy的配置文件`Caddyfile`: ``` vim /etc/caddy/Caddyfile ``` ``` domain { reverse_proxy localhost:8080 } ``` > domain :你的域名,caddy会自动配置https > > 8080 :FileBrowser运行的端口 完成! Last modification:November 21, 2020 © Allow specification reprint Like 1