您可以尝试使用拆分客户端模块:
http {
# Split clients (approximately) equally based on
# client ip address
split_clients $remote_addr $cdn_host {
33% cdn1;
33% cdn2;
- cdn3;
}
server {
server_name example.com;
# Use the variable defined by the split_clients block to determine
# the rewritten hostname for requests beginning with /images/
location /images/ {
rewrite ^ http://$cdn_host.example.com$request_uri? permanent;
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5222 次 |
| 最近记录: |