php - External network pages display a large number of internal network images. Which method is most efficient?
过去多啦不再A梦
过去多啦不再A梦 2017-05-17 09:55:19
0
3
555

The server is an intranet, maps an external network address, and has a web program that displays pictures of other servers on the intranet. The current approach is to use PHP's file_get_contents method to download the image, and then use nginx to proxy the external IP address to the PHP program, so that the image can be accessed. The amount of pictures every day is about 6 million, and after the front-end page is opened, a large number of pictures are not fully displayed. The previous method was to download all the images to the local server, but the disk pressure was very high and the images needed to be deleted every day. Please tell me, Dashenmen, is there a good way to transfer this image?

过去多啦不再A梦
过去多啦不再A梦

reply all(3)
某草草

Qiniu mirror mode, when you visit Qiniu for the first time, Qiniu has no pictures. At this time, Qiniu will return to the source site to grab pictures. The source site will use your original strategy when the first picture is accessed. Once there is an image on your local server, it means that the image has been cached by Qiniu, that is, the image can be deleted.

Specific setting steps:

1.Set Qiniu mirror mode to your site

2. Keep your downloaded image resources to your local policy implementation

3. Set up a scheduled script on the local server to clean up the images of the file mtime one hour ago

4.Set the url domain name of your site image to Qiniu image domain name

巴扎黑

nginx reverse proxy image server.

迷茫

Save all the pictures on one disk (or multiple disks), and then mount this disk on each server, that’s it

As mentioned above, nginx reverse proxy can also be used

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!