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