静态资源由nginx 处理。通过 location 正则匹配到静态资源的url 引导到静态资源服务。
动态资源由 动态应用程序 FastCGI 处理。

  1. http {
  2. upstream tuling1 {
  3. server http://img.aaa.com;
  4. }
  5. server {
  6. ### 静态资源引导到专有的静态资源服务器
  7. location ~*\.(jpg|gif)$ {
  8. proxy_pass http://tuling1;
  9. }
  10. ### 引导到本地资源目录
  11. location ~ .*\.(html|htm|gif|jpg|jpeg|bmp|png|ico|js|css)$ {
  12. root /Users/dalaoyang/Downloads/static;
  13. }
  14. }
  15. }

静态服务器

将远端或转的资源 缓存到本地的目录,可以设置一个缓存时间,在缓存时间内,返回的时本地缓存的文件

image.png