Article Directory
1 Introduction
Nowadays, mobile phones are becoming more and more advanced, with more and more functions, and the camera functions of mobile phones are becoming more and more powerful, and the photos taken are getting clearer and clearer, but the size of digital photos has also skyrocketed. For people like the author who often take pictures, the capacity of the mobile phone is often alarmed, so the author transforms the computer at home into a photo server that can be uploaded, downloaded and accessed at any time. Today, the author will show you how to use the combination of Cpolar intranet penetration and Lightpicture to transform a personal computer into a picture bed server that can upload, download or access at any time, and can generate external links.
2. Lightpicture website construction
Lightpicture is an open source lightweight image bed system that not only supports local image storage, but also can configure third-party cloud disks as storage space. Of course, it also supports multi-user registration, making it an independent picture website. The most important thing is that Lightpicture has a high value and makes people look very comfortable. Now, let's get started.
2.1. Download and install Lightpicture
The download website of Lightpicture cannot be opened (I don’t know if it is due to lack of maintenance), so I found a download on the Internet ( https://bbs.liuxingw.com/t/47221.html ), of course CSDN also has member downloads. Anyway, as long as the Lightpicture file is downloaded. After the Lightpicture source code is downloaded, unzip it.
Paste the entire decompressed folder into the root directory of the website. The author uses the integrated panel of phpstudy, so put the lightpicture folder under the WWW folder of phpstudy.
Then, open it phpstudy
, click the button on the left side of the main interface of the software 网站
to enter the website list page, and then click the button on the upper left of the website list page 创建网站
to enter the setting page of the newly created website.
On the website setting page, there are not many things we need to set up, as long as we set
域名
- The domain name entered when opening the Lightpicture file manager locally, you can enter it at will;端口
- Web output port of the Lightpicture file manager, as long as it is not occupied;根目录
– That is, the storage location of the webpage files of the Lightpicture file manager. In this example, the author puts these files under the www folder of phpstudy; it should be noted that the root directory cannot only point to the lightpicture folder, but point to it The public folder under the lightpicture folder.程序类型
– Since Lightpicture file manager is a lightweight web program, it needs to rely on php7.2.5 and above to run, so I choose php7.2.9. Note: Lightpicture needs to enable the PDO, fileinfo, and curl extensions of php, otherwise it may cause website errors.数据库
– Lightpicture needs database support when running, so you can check the "Create database" column in the website settings to create a database used by lightpicture.
After completing the relevant settings, you can click the bottom 确认
button to save the settings of the Lightpicture webpage.
After the basic settings of the webpage are completed, we still need to modify it 重写规则(Rewrite)
, otherwise when we log in to the website, the user login error will be displayed. Apache and Nginx are as follows:
- Apache:
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On
RewriteCond %{
REQUEST_FILENAME} !-d
RewriteCond %{
REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
- Nginx:
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
Since the author is using Nginx, find the file named in the public folder under the lightpicture website folder, nginx.htaccess
and paste the above Nginx code into it.
Then, enter it in the browser 域名:install
to start the installation program. The installation process is very simple, just 下一步
go all the way.
After the installation is complete, if you log in to the lightpicture website directly, it will display未设置默认文档
Here we only need to click on the right side of the lightpicture website entry in phpstudy 管理
, 网站首页设置
and then index.php
paste it index.html
to modify the weight of the index.html document. At the same time, the extension of php can also be found in the management button on the right side of the website entry, and the enable option can be found.
2.2. Lightpicture web page test
After completing the above steps, enter again in the address bar of the browser 域名+端口号(笔者输入的是localhost:82)
to access the local lightpicture web page.
It should be noted that lightpicture comes with a default administrator account (user name admin, password 123456), after we log in with the administrator account, we must remember to modify it.
2.3.cpolar installation and registration
After completing the construction of the lightpicture image bed, you can transfer to the installation of cpolar intranet penetration. Compared with lightpicture website settings, the installation and registration of cpolar intranet penetration is much simpler. We directly visit cpolar's official website page ( https://www.cpolar.com/ ) to find 下载
the button.
The author uses the Windows operating system, so choose the Windows version to download.
After the download of Cpolar is complete, decompress the downloaded file, double-click the decompressed .msi
file, and the installation program can be executed automatically. Then just go all the way Next
to complete the installation.
cpolar will create an independent data tunnel for each user, and add user password and token code to ensure data security, so user registration is required before using cpolar. The registration process is very simple, just click on the upper right corner of the cpolar homepage 用户注册
, fill in the necessary information on the registration page, and the registration can be completed.
3. Local web publishing
At this point, we have completed the local test of lightpicture and installed the cpolar intranet penetration program. Then we can use cpolar to create a public Internet address that can connect to the local lightpicture, so that we can access lightpicture on the public Internet Picture bed website.
3.1. Cpolar cloud settings
Since the picture bed website needs to be online for a long time, and the data tunnel created by the free version of cpolar will be reset every 24 hours, I don’t want to reset the data tunnel every day, so I upgrade cpolar to the VIP version so that I can access the lightpicture website stably for a long time. Next, we can start to penetrate the local area network at home, and penetrate the local lightpicture image bed into the intranet.
To achieve the purpose of intranet penetration, you need to log in to cpolar's official website first, find the 预留
button on the left side of the user's main page, and click to enter the reserved page of cpolar's data tunnel. A public Internet address is generated here (it can also be regarded as the entrance of the data tunnel). Since this address is not connected to the local lightpicture website at this time, it can also be regarded as a blank data tunnel.
On the reservation page, you can see many kinds of data tunnels that can be reserved. Here we select 保留二级子域名
the field.
In 保留二级子域名
the field, you need to make simple settings for several items of information, namely
地区
(The area where the server is located, just choose 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 the 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.
Of course, if the data tunnel is not going to be used, you can click the "x" on the right to delete it easily, saving valuable data tunnel quota.
3.2.Cpolar local settings
After completing the setting of cpolar cloud and keeping the blank data tunnel, we return to the local cpolar client and connect the blank data tunnel generated by the cloud with the local lightpicture page, so that we can access the local lightpicture website on the public Internet.
Open and log in the cpolar client locally (you can enter localhost:9200 in the browser to access directly, or click the shortcut of the cpolar client in the start menu).
隧道管理
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 that resets the address every 24 hours, you can directly perform the same settings on the cpolar local client instead of setting blank on the cpolar official website data tunnel).
On this page, several information settings also need to be made, including:
隧道名称
– It can be regarded as the local tunnel information annotation of cpolar, which is convenient for us to distinguish;协议
– Since lightpicture is a web program, choose the http protocol;本地地址
– The local address is the output port number of the lightpicture image bed, and the port we set is 82, so fill in 82 here;域名类型
– In this example, we have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, so check the "second-level subdomain name" (if the reserved domain name is a custom domain name, check the custom domain name). And fill in the reserved second-level subdomain name in the "Sub Domain" column on the next line, which is "lightpicweb" in this example. If you plan to create a temporary data tunnel, you can directly check "Random domain name", and the cpolar client will generate the network address by itself;地区
– It is the same as the information reserved in the cpolar cloud, we can fill it in according to the actual use;
After completing these settings, you can click 创建
the button at the bottom of the page to connect the blank data tunnel on the cpolar cloud with the local lightpicture page, and generate an intranet penetration data tunnel that can access the local lightpicture image bed on the public Internet.
We can manage this data tunnel on the page 隧道管理
under the item 隧道列表
, including opening, closing or deleting this tunnel, or click the "Edit" button to modify the information of this data tunnel.
4. Public network access test
Finally, we click the button 状态
under the item on the left 在线隧道列表
to find the public Internet address of the lightpicture page, and paste this address into the browser to see the lightpicture page on the local computer.
5 Conclusion
As an indispensable auxiliary website for modern websites, the picture bed is of self-evident significance to self-built websites. However, since this business is not profitable, major Internet companies have gradually shut down this business, making self-built map beds an inevitable choice. Of course, there are tens of thousands of picture bed software, and we can use the same method to publish other picture bed websites to the public Internet in the same way.
Reprinted from the article of cpolar pole cloud: [Build a private picture bed] Use LightPicture to open source to build a picture management system and access it remotely