Filebrowser 安装简介

官网地址:

https://filebrowser.org

https://github.com/filebrowser/filebrowser

 

官网安装方法:

curl -fsSL https://filebrowser.org/get.sh | bash
filebrowser -r /path/to/your/files

手动安装

1 wget 或手动下载linux-amd64-filebrowser.tar.gz

2 tar -zxvf 解压后 执行文件filebrowser 放在 /usr/local/bin/ 目录下

3 mkidr /etc/filebrowser/

4 vi /etc/filebrowser/config.json

{
  "port": 8090,
  "address": "0.0.0.0",
  "noAuth": false,
  "password":"12345678",
  "root":"/data/fbroot",
  "alternativeReCaptcha": false,
  "reCaptchaKey": "",
  "reCaptchaSecret": "",
  "database":"/etc/filebrowser/filebrowser.db",
  "log":"/var/log/filebrowser.log",
  "plugin": "",
  "baseURL": "/filebrowser",
  "allowCommands": true,
  "allowEdit": true,
  "allowNew": true,
  "commands": [
    "ls",
    "df"
  ]
}

5 后台运行/停止 / 开机启动和停止

fb# filebrowser -c /etc/filebrowser/config.json

# nohup filebrowser -c /etc/filebrowser/config.json -d /etc/filebrowser.db >/dev/null 2>&1 &

# kill -9 $(pidof filebrowser)

# sed -i '/exit 0/i\nohup filebrowser -d \/etc\/filebrowser.db >\/dev\/null 2>&1 &' /etc/rc.local

# sed -i '/nohup filebrowser -d \/etc\/filebrowser.db >\/dev\/null 2>&1 &/d' /etc/rc.local

6 浏览器访问 ip:8090

7 Nginx 反代

########   filebrowser ###########
location /filebrowser/ {
            proxy_pass http://localhost:8090;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
########   filebrowser ###########

8 https 跳转

   if ($scheme = http) {
      return 301 https://$server_name$request_uri;
   }

9 零时管理员密码重置/添加

filebrowser -d /etc/filebrowser/filebrowser.db users update admin -p 123456

filebrowser -d /etc/filebrowser/filebrowser.db users add root 123456 --perm.admin

10 Systemd

# vi /etc/systemd/system/filebrowser.service

[Unit]
Description=The filebrowser Process Manager
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/filebrowser -c /etc/filebrowser/config.json
ExecStop=/bin/killall filebrowser
PrivateTmp=true

[Install]
WantedBy=multi-user.target

11 人机验证

A:注册服务

https://www.google.com/recaptcha/admin

 

 

 B:停止FB服务 # systemctl stop filebrowser.service

C:配置验证服务

[root@test filebrowser]# filebrowser config set --auth.method=json

[root@test filebrowser]#  filebrowser config set --auth.method=json \
    --recaptcha.key 11111111111111111111111111111 \
    --recaptcha.secret  2222222222222222222222222

[root@test filebrowser]#  filebrowser config set --recaptcha.host http://recaptcha.net

[root@test filebrowser]# filebrowser config set --auth.method=json

  ......

Auther configuration (raw):
{

  "recaptcha": {

    "host": "https://recaptcha.net",
    "key": "11111111111111111111111111111",
    "secret": "22222222222222222222222222"
  }
}

D:启动服务后确认

 

posted @ 2020-10-15 10:56  tamatama  阅读(5972)  评论(0编辑  收藏  举报
GO TOP