Article directory
- 1 Introduction
- 2. CFImagehost website construction
-
- 2.1 CFImagehost download and installation
- 2.2 CFImagehost web page test
- 2.3 Installation and registration of cpolar
- 3. Local web page publishing
-
- 3.1 Cpolar temporary data tunnel
- 3.2 Cpolar Stable Tunnel (Cloud Settings)
- 3.3.Cpolar stable tunnel (local settings)
- 4. Public network access test
- 5 Conclusion
1. Preface
The picture server is also called the image server. It can be said to be one of the most important applications in Internet storage. Not only do websites need the external links provided by the image server to retrieve pictures, but individuals or businesses also use the image server to store various images for easy access and viewing at any time. . However, because image beds are not very profitable, major Internet companies are gradually shutting down their image bed servers. This has also resulted in users having to find ways to build their own image bed servers. Today, the author will introduce to you how to use Cpolar + CFImagehost to build a simple and easy-to-use private image bed.
2. CFImagehost website construction
CFImagehost is a very well-known image hosting program abroad, and many people use it in China. Its appearance design and functional layout are simple and easy to use, making it very user-friendly. However, the fly in the ointment is that CFImagehost currently does not have an official Chinese version, resulting in imperfect Chinese display of some pages. In any case, CFImagehost is still an image hosting program worth using.
2.1 CFImagehost download and installation
CFImagehost is an open source program, so we can find it for download on github (https://github.com/wbbim/cfimagehost-on-openshift). At the same time, there are also many Chinese-CFImagehost source codes on the Internet, you can choose according to your needs.
After the download of CFImagehost is completed, unzip the downloaded compressed package to get the source code folder of CFImagehost. Paste this folder into the website folder. I am using the phpstudy integrated panel, so paste the CFImagehost folder into the WWW folder
of phpstudy.
Next, 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 side of the website list page to enter the settings page for the new website .
On the website settings page, there are not many things we need to set. We only need to set
Domain name
– The domain name entered when opening the CFImagehost website locally, you can enter it at will;Port
– The web page output port of the CFImagehost website, as long as it is not occupied;Root directory
– This is the location where CFImagehost website files are stored. In this example, the author places these files in the www folder of phpstudy;Program type
– Since the CFImagehost website is a lightweight web program and requires php5X or above to run, the author chose php7.2.9 (Note: After actual testing, I feel that php5.6 has better compatibility. Everyone can choose according to the actual situation).Database
– It is not necessary to configure the database when setting up the CFImagehost website. The database will also be configured during the website installation process. However, in order to save installation time, the author chose to set the database information at this time.
Note: Regarding pseudo-static rules, Apache comes with pseudo-static rules, so there is no need to make additional settings (the author also chose Apache as the web page program). But if you use Nginx as a web page program, you need to write the following code into the pseudo-static rule.
rewrite /pm-(.*)\.(jpg|png|gif|html)$ /index.php?pm=$1; rewrite /pt-(.*)\.(jpg|png|gif|html)$ /index.php?pt=$1; rewrite /dt-(.*)\.(jpg|png|gif)$ /index.php?dt=$1; rewrite /dm-(.*)\.(jpg|png|gif)$ /index.php?dm=$1; rewrite /di-(.*)\.(jpg|jpeg|png|gif|bmp)$ /index.php?di=$1; rewrite /gallery/(.*)\/$ /gallery.php?p=$1;
After completing the relevant settings, you can click the Confirm
button at the bottom to save the settings of the CFImagehost website.
Then we enter local address:port number
in the browser address bar (here I entered localhost:82) to enter the installation program of the CFImagehost website. The website installation process is no different from other websites, just follow the prompts on the web page.
Here, CFImagehost will check the installation environment. What we need to pay attention to is that the GD
and cURL
extensions of php need to be turned on.
In this step, CFImagehost will check the database. If there is no database set up in pgpstudy, CFImagehost will set up the database in this step.
After the CFImagehost website is installed, we return to the root directory of CFImagehost and delete the entire install
folder. Otherwise, the CFImagehost website installation page will be displayed repeatedly when accessing the CFImagehost website.
2.2 CFImagehost web page test
After completing the installation of the CFImagehost website, we enter local address: port number
(localhost:82) in the browser address bar to open the main page of the CFImagehost website. In the upper right corner of the main page, you can select the website language.
If you want to enter the backend page of the CFImagehost website, you need to add admin.php
after the local address of the CFImagehost website. On the background page, you can make detailed settings for the CFImagehost website. The default background administrator login name of CFImagehost is admin, and the login password is password. After entering the CFImagehost background, the administrator username and password should be modified promptly.
2.3 cpolar installation and registration
After completing the CFImagehost website settings, you can move to the cpolar installation. Compared with CFImagehost website deployment, the installation and registration of cpolar is much simpler. You can find the “Download” button directly on cpolar’s official website page (https://www.cpolar.com/).
The author is using the Windows operating system, so I chose the Windows version of cpolar 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.
cpolar will create an independent data tunnel for each user to ensure data security with user password and token code. Therefore, user registration is required before using cpolar. The registration process is 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.
3. Local web page publishing
At this point, we have completed the deployment of the local CFImagehost website and installed the cpolar intranet penetration program. Next, we can use cpolar to create an intranet penetration data tunnel that can connect to the local CFImagehost website, allowing us to access the local CFImagehost website on the public Internet.
3.1 Cpolar temporary data tunnel
In order to meet the temporary testing function of web pages required by some customers, cpolar can create a temporary data tunnel directly on the cpolar client (the public Internet address is reset every 24 hours). To create a temporary data tunnel, we log in to the cpolar client directly on the local device (enter localhost:9200 in the browser address bar), and click Tunnel Management
on the main interface of the cpolar client. >Create Tunnel button to enter the tunnel creation setting page.
On the “Create Tunnel” page, we need to set several information settings, which include:
Tunnel name
– can be regarded as the tunnel information comment of the cpolar client, as long as it is convenient for us to distinguish;Protocol
– The CFImagehost website is a web program, so choose the http protocol;Local address
– The local address is the output port number of the local CFImagehost website, so fill in 82 here;Domain name type
– Here we can distinguish whether the data tunnel is for temporary use or long-term existence. Since we are only conducting a temporary test first, we choose “random domain name” (the second-level subdomain name and custom domain name are both long-term stable tunnels and need to reserve a public Internet address in the cpolar cloud).Region
– This is the location of the server. We can fill it in according to the actual location;
After completing these settings, you can click the Create
button at the bottom of the page to establish a temporary data tunnel. After the temporary data tunnel is created, the cpolar client will automatically jump to the Tunnel List
page under the Tunnel Management
item. Here we can see all cpolar local data tunnels. (either temporary or long-term). We can also manage the data tunnel here, including opening, closing or deleting this tunnel. We can also click the “Edit” button to modify the information of this data tunnel.
The temporary public Internet address we created that can connect to the local CFImagehost website can be found in the Online Tunnel List
under the Status
item.
Paste the public Internet address shown here into your browser address bar to access your local CFImagehost website page.
However, at this time, the CFImagehost data tunnel is only a temporary data tunnel, and the public Internet address is reset every 24 hours. If you still want to connect to the local CFImagehost web page, you need to use a new address to connect.
3.2 Cpolar Stable Tunnel (Cloud Settings)
If we want to set up a long-term stable data tunnel for the local CFImagehost website, we need to upgrade cpolar to the VIP version first.
Next, we can log in to cpolar’s official website and find the Reservation
button on the left side of the user’s homepage. Click to enter cpolar’s data tunnel reservation page and generate a public Internet address here (you can see 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.
On the reservation page, you can see many types of data tunnels that can be reserved. Here we select the Reserved second-level subdomain name
field.
In the Reserve second-level subdomain name
field, you need to make several simple settings of information, namely
Region
(the region where the server is located, just select the nearest one)Second-level domain name
(will eventually appear in the generated public Internet address as one of the identifiers of the network address)Description
(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.
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.
3.3.Cpolar Stable Tunnel (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 with the local test page.
Open and log in to the cpolar client on the local device (you can enter localhost:9200 in the browser to access it directly, or you can click the cpolar client shortcut in the start menu).
Click the Tunnel List
button under the Tunnel Management
item on the left side of the client’s main interface to enter the local tunnel page, and then click the Edit
button of the corresponding tunnel. .
On the “Edit” page of the local tunnel (the same as the page for creating a local temporary tunnel), we only need to modify the Domain name type
to create the public Internet address reserved by the cpolar cloud and create it with the local cpolar The CFImagehost data tunnel is connected.
We have reserved the data tunnel of the second-level subdomain name in the cpolar cloud, so we changed it to Second-level subdomain name
(if the reserved domain name is a custom domain name, check the custom domain name), and click below Fill in the reserved second-level subdomain name in the Sub Domain
column. In this example, it is “CFImagehost”.
After completing the change of “Domain Name Type”, you can click the Update
button at the bottom of the page to connect the blank data tunnel in the cpolar cloud with the local CFImagehost website, thus generating CFImagehost website data that can exist stably for a long time. tunnel.
4. Public network access test
Finally, we enter the Online Tunnel List
page again, paste the updated public Internet address of the CFImagehost website into the browser, and you can see that the CFImagehost website can be accessed stably for a long time, achieving the goal of converting the local The purpose of the CFImagehost website is to publish it on the public Internet.
5. Conclusion
The CFImagehost website is just one of many website source codes. We can also install other types of website source codes on local devices and deploy websites with different functions and application scenarios. These websites can also be published to the public Internet using cpolar, allowing our local devices to become private website servers, bringing greater convenience to our lives and work.
Reprinted from cpolar pole cloud article: [PHP Image Hosting] Free CFimagehost image bed source code to build a private image bed – no database support required