[Private cloud disk] Build a PHP lightweight file manager - TinyFileManager "Remote access to public network"

foreword

File sharing and viewing are the most common application scenarios on the Internet today, and a large number of applications have also been produced. These applications have similar functions, but the installation and deployment processes are very different. However, for users, the most comprehensive file upload and download functions can be realized with the simplest installation process, which is the most suitable for users. Today, the author will introduce a php file management tool with only two files, Tiny File Manager, and use the data tunnel generated by cpolar to publish it to the public Internet, so that we can access our home from anywhere (office) computer files.

1. Tiny File Manager website construction

Tiny File Manager is an open-source small file manager based on the web. It is as simple as only two files, but it can support multiple functions such as uploading and downloading, multi-user login, multi-language support, and online compression and decompression. The only thing it needs is , which is php5.5+.

1.1. Download and install Tiny file manager

First we download a Tiny File Manager software, the software download address is on github ( https://github.com/prasathmani/tinyfilemanager ). After the download is complete, you can decompress the downloaded compressed file and paste the two files in it to the root directory of the website. The author uses the phpstudy webpage environment, so it is placed in the www folder under the phpstudy installation folder (similarly, it can also be placed in the root directory of the website of other environmental software, such as wamp, pagoda panel, etc.).

20230403103001

20230403103002

Next, change tinyfilemanager.phpthe file name to index.php. Then enter the address in the browser localhost, you can see the installation interface of Tiny File Manager.

20230403103003

After pasting the website file www文件夹and modifying the file name, you can enter the address in the browser to visit localhost (the default output port of phpstudy is 80, we can change the output port by creating a new web page).

1.2.Tiny file manager web page test

As long as the web page settings are correct, you can enter the web page of tinyfilemanager

20230403103004

Generally speaking, Tiny File Manager has two default accounts, namely admin and user, and the specific login names and passwords are

  • Account: admin Password: admin@123
  • Account: user Password: 12345

2. Installation and registration of Cpolar intranet penetration

Once you've finished installing your Tiny File Manager website, you can start creating a public Internet address for it. Here we use cpolar to complete the work of creating public Internet addresses.

We can find the cpolar software download on cpolar's official website ( https://www.cpolar.com/ ). The author uses the Windows operating system, so directly download the Windows version of cpolar.

20230403103005

20230403103006

After the Cpolar software download is complete, decompress the downloaded compressed package, and double-click the decompressed .msi文件, you can enter the automatic installation program, we only Nextneed to click all the way.

20230403103007

20230403103008

Since cpolar will establish a separate data tunnel for each user, and ensure the data security of each user through the user password and the token code generated separately by the user, we also need to register our own account on the official website. The registration process is also very simple, as long as you click on the top right of the official website 用户注册, you can enter the new user registration interface.

20230403103009

20230403103010

After completing the above installation and registration work, we can officially enter the local Tiny File Managerpublic Internet publishing work.

2.1 Local web publishing

After installing and registering cpolar intranet penetration, the rest of the work is very simple. Just use cpolar to build a data tunnel, and connect the entrance of the data tunnel generated by cpolar with the tiny file manager webpage port of the local computer to generate dedicated It belongs to the intranet penetration data tunnel with tiny file manager, allowing us to access the local tiny file manager web page on the public Internet.

Since file sharing emphasizes stability and long-term, it is necessary to upgrade cpolar to the vip version (the free version of cpolar can also create data tunnels, but the created data tunnels will be reset every 24 hours), so that they can be preserved for a long time. data tunnel, avoiding the trouble of setting up a data tunnel every day.

2.2 Cpolar cloud settings

预留After upgrading cpolar to vip, we first log in to the cpolar cloud, find the button on the left side of the customer main interface , click to enter the reserved page, and find 保留二级子域名the column

20230403103011

20230403103012

In the field of "Reserve the second-level subdomain name", you need to set several simple information, namely:

  • 地区: The area where the server is located, just select the nearest one
  • 二级域名: Will eventually appear in the generated public Internet address as one of the identifiers of the network address
  • 描述: It can be regarded as the description of this data tunnel, which can be distinguished from other tunnels

After completing these settings, you can click 保留the button on the right to keep this data tunnel.

20230403103013

Of course, if this data tunnel is no longer intended to be used, you can click the "x" on the right to delete it easily to save valuable data tunnel quota.

20230403103014

2.3 Cpolar local settings

After completing the setting of cpolar cloud, half of the data tunnel that can penetrate the LAN is completed. Next, we go back to the local computer and log in to the cpolar client (you can enter localhost:9200 in the browser, or click the shortcut of cpolar in the start menu)

20230403103015

After entering the cpolar client, click the button on the left side of the main interface of the client 隧道管理to 创建隧道enter the local tunnel creation page (if you want to create a temporary data tunnel, you can directly set it here instead of setting a blank data tunnel on the cpolar official website).

On the tunnel creation page, we also need to set several information, including:

1. 隧道名称– It can be regarded as cpolar’s ​​local tunnel information comment, as long as it is convenient to distinguish;
2. 协议– Since the output of tiny file manager is a web page, the http protocol is selected here;
3. 本地地址– The local address is the output of tiny file manager Port number, so fill in the default port 80 here;
4. 域名类型– Since we have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, and generated the public Internet second-level domain name of tiny file manager, here we tick Select "Second-level sub-domain name" (if the reserved domain name is a custom domain name, check the custom domain name), and fill in the reserved second-level sub-domain name in the "Sub Domain" column on the next row. Of course, if you are creating a temporary data tunnel, just check "Random Domain Name" directly, and the cpolar client will generate a network address by itself, without having to set it on the cpolar cloud; 5. –
This 地区line is the same as the setting on the cpolar cloud, both It is the choice of the server region, we can fill it in according to the actual use;

20230403103016

After filling in the required information, you can click 创建the button at the bottom of the page to generate a data tunnel that penetrates the local area network, allowing us to access the tiny file manager webpage on the local computer on the public Internet.

At the same time, cpolar will automatically transfer to the "Tunnel List" page under the "Tunnel Management" item. On this page, we can manage the tunnels that have been created, such as starting, suspending, and deleting; To modify, you can also click the "Edit" button here to enter the data tunnel information modification page.

20230403103017

3. Public network access test

Finally, we click the button on the left side of the cpolar client to enter the online tunnel list page, and get the public Internet access address that can connect to the local tiny file manager from here. Just paste this address into the browser of other devices to 状态access 在线隧道列表to seafile's server.

20230403103018

20230403103019

4. Conclusion

It is not difficult to see from the above introduction that it is very simple to install tiny file manager on the local computer, and the steps to publish it to the public Internet using cpolar intranet penetration are also very fast. But it has strong practical significance to allow us to access files in the LAN on the public Internet, so everyone should try it.

Guess you like

Origin blog.csdn.net/weixin_44624117/article/details/129940514