技术解析

Chevereto Nginx服务器 伪静态规则
0
2021-04-29 16:44:46
idczone

Chevereto 服务器由 Apache 转到了 Nginx,同时启用了 CDN。规则内置限制 CDN 访问动态页面判断。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
location ~ images/(.*)$ {
  if ($host = "up.chevereto.com"){
    rewrite ^/(.*) https://up-img.chevereto.com/$1 redirect;
  }
}
 
location ~ content/(.*)$ {
  if ($host = "up.chevereto.com"){
    rewrite ^/(.*) https://up-img.chevereto.com/$1 redirect;
  }
}
 
location ~* \.(html|htm)$ {
  if ($host = "up-img.chevereto.com") {
    return 403;
  }
}
 
# CORS header (avoids font rendering issues)
location ~ \.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
  add_header Access-Control-Allow-Origin "*";
}
 
location ~* (jpe?g|png|gif) {
  log_not_found off;
  error_page 404 /content/images/system/default/404.gif;
}
 
 
# Pretty URLs
location / {
  if ($host = "up-img.chevereto.com") {
    return 403;
  }
   
  try_files $uri $uri/ /index.php?$query_string;
}

Categories


数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服