代码拉取完成,页面将自动刷新
sudo mkdir -p /mnt/disk1/simplehttpfs/{dir1,dir2}
sudo echo 'Hello world' > /mnt/disk1/simplehttpfs/hello.txt
sudo echo 'Hello world 1' > /mnt/disk1/simplehttpfs/dir1/hello1.txt
sudo echo 'Hello world 2' > /mnt/disk1/simplehttpfs/dir2/hello2.txt
tree /mnt/disk1/simplehttpfs/
.
├── hello.txt
├── dir1
│ └── hello1.txt
└── dir2
└── hello2.txt
2 directories, 3 files
sudo echo '127.0.0.1 pkg.wl4g.io' >> /etc/hosts
sudo mkdir -p /etc/nginx/conf.d/
sudo cat <<-EOF >/etc/nginx/conf.d/pkg.conf
#
# Site for pkg configuration.
#
server {
listen 80;
server_name pkg.wl4g.io;
#listen 443 ssl;
#server_name pkg.wl4g.io;
#ssl_certificate cert.d/pkg.wl4g.io.pem;
#ssl_certificate_key cert.d/pkg.wl4g.io.key;
#ssl_session_timeout 5m;
#ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_prefer_server_ciphers on;
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;
location / {
proxy_pass http://localhost:28001;
}
}
EOF
sudo systemctl restart nginx
git clone https://gitee.com/wl4g/simple_httpfs.git
cd simple_httpfs/
# Build package
make
# Copy configuration
sudo mkdir -p /etc/simplehttpfs/
sudo cp config/* /etc/simplehttpfs/
# Installing systemd
sudo cp scripts/systemd/simplehttpfs.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl restart simplehttpfs
sudo systemctl status simplehttpfs
sudo journalctl -afu simplehttpfs
Browser access
Default config load at: /etc/simple_httpfs/server.ini
Config items description:
Config Key | Type | Default Value | Example Value | Description |
---|---|---|---|---|
[http.server].listen_addr | string | 0.0.0.0 | 192.168.2.101 | Listening http server sock address. |
[http.server].listen_port | int | 28001 | 8888 | Listening http server sock port. |
[http.server].server_version | string | Google-SimpleHttpFS/2.0 | Microsoft-SimpleHttpFS/2.0 | http server information. |
[http.server].cert_file | string | nil | /etc/simple_httpfs/server.pem | https tls certificate file path. |
[http.acl].<username>=<acl_rule_json> | string | <required> | admin={"password":"123","rules":[{"path":"^/(.*)","permit": "rw"}]} |
Access controller list configuration, the example indicates that the user user1 is allowed to request resources that satisfy the path ^/dir1/(.*) and the permissions are r and w , Tips: only when it has the 'w' permission The upload file button will appear. More example see: config/server.ini
|
[fs.rendering].mime_types | string | /etc/simple_httpfs/mime_types | ./config/index.tpl | HttpFS rendering template file. |
[fs.rendering].tpl_file | string | /etc/simple_httpfs/index.tpl | ./config/index.tpl | HttpFS rendering template file. |
[fs.data].data_dir | string | <work_dir> | /mnt/disk1/httpfs | The directory where the actual files of HttpFS. |
openssl req -new -x509 -keyout ./httpfs_server.pem -out ./httpfs_server.pem -days 365 -nodes -subj "/C=/ST=/O=/OU=/CN="
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。