Easy cloud storage acceleration without modifying program code

Source: Internet
Author: User

Recently, the company's website opened very slowly, and the Internet pressure test found that the bandwidth was always at the peak. A few days ago, I heard that cloud storage has the image function. More importantly, it is free of charge. Haha, start work...

If you call cloud storage from the program itself, you need to modify too much code .. Whimsy: Can I use nginx's reverse proxy to parse static file requests to cloud storage?

Term: Main Site: website to be accelerated

Steps:

1. Copy the main station program to a new directory, create a website in nginx, and use static for the domain name to test whether the website can be accessed normally. Normal access. 3.

2. If the program locates website resources through an absolute path, you need to modify the configuration file, such as the config file. Change the domain name to static...

3. Create a symbolic link to the static file directory of the ln-s main site. The static file directory of the new domain name

4. Go to qiniu cloud storage image static website

5. Modify the main site conf configuration as follows:

Location ~ . *\. (Css | js | gif | jpg | jpeg | png | bmp | swf) $ {proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; proxy_pass http://ibrahim.qiniudn.com; proxy_redirect off ;}


Reload ningx, enjoy the pleasure of cloud storage acceleration ..

I am using qiniu cloud storage and can directly use images. Others are not tested.

URL: https://portal.qiniu.com/signup? Code = 3l8yx1titpyz6

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.