Use Lychee to build a personal image storage system and set up remote access to access the local private image bed from the public network

1 Introduction

As a service website for centralized storage of pictures, Picture Bed can be regarded as a part of cloud storage. It can not only be used as a storage space for us to store photos, but also create external links to become the source of pictures for websites or articles. However, as the cloud storage operated by large manufacturers is declining, the days of various drawing beds are also not easy, and some drawing beds have even closed down. Under such circumstances, building your own map bed seems to be the only reliable option. Today, the author will show you how to use Cpolar+Lychee to build a simple and beautiful private picture website.

2. Lychee website construction

Lychee is an open-source free image bed software based on PHP. Just like the translation of its name, Lychee is as clean and transparent as lychee, and it also provides convenient image operation and editing grouping, as well as user management, image preview and external links. . For private users, it is undoubtedly very friendly.

2.1. Lychee download and installation

Since lychee is an open source project, it is natural to find its download link on github. Of course, you can also enter the download page from its official website.

20230428105301

20230428105302

After downloading the relevant files of Lychee, decompress the downloaded compressed package and place the file in the site root directory of the running environment. The author uses phpstudy as the website running environment, so place the lychee website files in the WWW folder. .

20230428105303

20230428105304

Then, open phpstudy, click the "Website" button on the left side of the software's main interface to enter the website list page, click the "Create Website" button on the upper left to enter the settings page for the new website.

On the website settings page, there is not much we need to set, just set:

  • 域名- The domain name of the local lychee website can be entered at will;
  • 端口– For the output port of the local lychee web page, just select an unoccupied port;
  • 根目录– That is the storage location of lychee web page files;
  • 程序类型–lychee is a web image bed program that requires php7.2+ to run, so choose php7.2.9
  • 创建数据库– Since the operation of the lychee website depends on the database, we also need to set up the database for lychee. Just check "Create Database" in the "Create Environment" column.

After these settings are completed, you can click the "Confirm" button at the bottom to save the settings of the lychee website.

20230428105305

It should be noted that the installation of lychee requires some PHP extension components, including: Session, exif, mbstring, gd, mysqli, json, zip, imagick, optionally

Fortunately, phpstudy provides check options for PHP extensions, so that we do not have to configure these PHP extensions one by one (this is why I like to use integrated environments to deploy websites)

20230428105306

2.2 Lychee web page test

After setting up the lychee web page, you can enter it in the browser localhost:端口号to access the local lychee web page login interface. The login account and password that need to be entered here are the database login name and password that were previously set up for the lychee website.

20230428105307

20230428105308

2.3 Installation and registration of cpolar

After completing the setup of the lychee website, you can continue to install cpolar. Like the installation of the lychee website, the cpolar 下载button can also be found directly on the cpolar official website page.

cpolar official website: https://www.cpolar.com/

20230428105309

The author is using the Windows operating system, so I chose the Windows version to download.

After the Cpolar download is completed, unzip the downloaded file and double-click the decompressed .msi file to automatically execute the installation program. Then just click "Next" to complete the installation.

20230428105311

20230428105312

To ensure data security, cpolar will create an independent data tunnel for each user, so we need to register as a user before using cpolar. The registration process is also very simple. Just click "User Registration" in the upper right corner of the cpolar homepage and fill in the necessary information on the registration page to complete the registration.

20230428105313

20230428105314

3. Local web page publishing

At this point, we have completed the construction of the local lychee picture bed website and installed the cpolar intranet penetration program. Next, we can use cpolar to create an intranet penetration data tunnel, allowing us to access the local network on the public Internet. The lychee picture bed website.

3.1 Cpolar cloud settings

Usually the data tunnel created by the free version of cpolar is reset every 24 hours. In order to ensure the long-term stable existence of our picture bed website, the author upgraded cpolar to the VIP version.

Next, we log in to cpolar's official website, find the "Reserve" button on the left side of the user's homepage, and click to enter cpolar's data tunnel reservation page. Set a public Internet address here (can be regarded as the entrance of the data tunnel). Since this address is not connected to the local software output port at this time, it can also be regarded as a blank data tunnel.

20230428105315

On the reservation page, you can see many types of data tunnels that can be reserved. Here we select the "Reserve second-level subdomain name" field.

20230428105316

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

  • 地区(Select the area where the server is located)
  • 二级域名(will eventually appear in the generated public Internet address as one of the identifiers of the network address)
  • 描述(It can be regarded as a description of this data tunnel, as long as it can be distinguished from other tunnels).

After completing these settings, you can click the "Reserve" button on the right to retain this data tunnel.

20230428105317

Of course, if you no longer plan to use this data tunnel, you can click the "x" on the right to easily delete it and save valuable tunnel quota.

20230428105318

3.2 Cpolar local settings

After completing the settings of the cpolar cloud and retaining the blank data tunnel, we returned to the local cpolar client and connected the blank data tunnel generated by the cloud to the local test page so that we can access the local test on the public Internet. page.

Open and log in to the cpolar client locally (you can enter localhost:9200 in the browser to access it directly, or you can click the cpolar client shortcut in the start menu).

20230428105319

Click the "Create Tunnel" button under the "Tunnel Management" item on the left side of the client's main interface to enter the local tunnel creation page (if you want to create a temporary data tunnel that resets the address every 24 hours, you can set it directly here without cpolar The official website sets up a blank data tunnel).

On the page for creating a tunnel on the cpolar client, you also need to make several information settings. These information settings include:

1. 隧道名称– This is the comment of the cpolar local tunnel, as long as it is convenient for us to distinguish;
2. 协议– Since the test page is a web page, choose the http protocol;
3. 本地地址– It is the output port number of the local website, so fill in 86 here as well ;
4. 域名类型– Since we have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, check the “secondary subdomain name” (if the reserved domain name is a custom domain name, check the custom domain name), and click below Sub DomainFill in the reserved second-level subdomain name in one line. Here we fill in "lycheeweb".
But if you plan to create a temporary data tunnel, just check "Random domain name" directly, and the cpolar client will generate the network address by itself;

5. 地区- It is the same as the information reserved in the cpolar cloud, we can fill it in according to the actual place of use;

20230428105320

After completing these settings, you can click the "Create" button at the bottom of the page to create a data tunnel that can access the local lychee website on the public Internet. We can manage this data tunnel on the "Tunnel List" page under "Tunnel Management", including opening, closing or deleting this tunnel. We can also click the "Edit" button to edit the information of this data tunnel. to modify.

20230428105321

4. Public network access test

Finally, we click the "Online Tunnel List" button under the "Status" item on the left to find the public Internet address of the lychee website.

20230428105322

Paste this address into the browser and you will see the login page of the local lychee website. After entering the login name and password, you can access the local image bed page on the public Internet.

20230428105323

20230428105324

5 Conclusion

At this point, we have completed the deployment of the local lychee image bed, and penetrated the data tunnel through the intranet generated by cpolar, publishing it to the public Internet, making our local computer a private image bed. Of course, cpolar can also cooperate with other websites or software that plays a role in other application scenarios.

Reprinted from cpolar pole cloud article: [Lychee Picture Bed] Build a private picture bed on a local computer and access it remotely from the public network

Guess you like

Origin blog.csdn.net/xz2935117143/article/details/133926499