Caddy's public IP using the extension set up file sharing server Filemanager

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_25908839/article/details/94359140

Thanks to 99 yuan Ali cloud server! ! ! !

The device is: Linux Ubuntu 64 Wei

step

linux arm64 with filemanager 1. Download the Caddy version

Official website has no need to download, thanks CSDN bloggers: train chase shared version

https://download.csdn.net/download/tmt123421/10916091

2. Extract

caddy_v0.11.1_linux_amd64_custom_personal.tar.gz stored in the # / root / caddy

# tar -zxvf caddy_v0.11.1_linux_amd64_custom_personal.tar.gz 

3. Create files and folders

Created under # / root / caddy / folder

# mkdir www && mkdir ./www/file

Other files are stored in a file called bak folder inside, as shown below

4. profile information

Create a file called Caddyfile and write configuration information to file

# touch Caddyfile

Configuration information is as follows

公网IP:2015 {
root /root/caddy/www/file
timeouts none
gzip
filemanager / /root/caddy/www/file {
 database /root/caddy/filemanager.db
}
log ../access.log

}

If not using public IP, just use the file-sharing servers in the LAN, the public IP to a string localhost, this time to become

localhost:2015

Port can be customized, it does not conflict with the default port on the line

Configuration details information please Tell me what network description: https://caddyserver.com/docs

At this point the / root / caddy / directory has the following files. Note: filemanager.db temporarily not generate

5. Open firewall ports open

Ali is used because the cloud server, the first to add a new set of rules for security in 2015 Ali port cloud server instance, or outside the network can not access the public network port.

Ali cloud instance as follows

Then add security to find the set of rules, add the appropriate port

Port Range: 2015/2015

授权对象:0.0.0.0/0

填完后,在开启服务器防火墙的 2015 端口,命令和结果如下

# ufw allow 2015
# ufw status
Status: active

To                         Action      From
--                         ------      ----
20,21,22,80,888,8888/tcp   ALLOW       Anywhere                  
39000:40000/tcp            ALLOW       Anywhere                  
888/tcp                    ALLOW       Anywhere                  
2015                       ALLOW       Anywhere                  
2016                       DENY        Anywhere                  
443                        ALLOW       Anywhere                  
20,21,22,80,888,8888/tcp (v6) ALLOW       Anywhere (v6)             
39000:40000/tcp (v6)       ALLOW       Anywhere (v6)             
888/tcp (v6)               ALLOW       Anywhere (v6)             
2015 (v6)                  ALLOW       Anywhere (v6)             
2016 (v6)                  DENY        Anywhere (v6)             
443 (v6)                   ALLOW       Anywhere (v6)             

当显示 2015 (v6) allow时,说明此服务器端口已经开启了。

6.后台运行

编辑 # /etc/rc.local 文件,在文件 exit 0 之前添加如下执行的命令

cd /root/caddy
./caddy &
# cat /etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
cd /root/caddy
./caddy &
exit 0

在浏览器输入IP地址和端口号

公网IP:2015

结果如下,初始账号密码 admin/admin

 

Guess you like

Origin blog.csdn.net/qq_25908839/article/details/94359140
Recommended