//default dynamic, static directly find the set static, upload find upload
upstream static_pools {
server 10.0.0.9:80 weight=1;
}
upstream upload_pools {
server 10.0.0.10:80 weight=1;
}
upstream default_pools {
server 10.0.0.9:8080 weight=1;
}
server {< br /> listen 80;
server_name www.xuliangwei.com;
url: https://www.xuliangwei.com/
location / {
proxy_pass http://default_pools;
include proxy.conf;
}
url: https://www.xuliangwei.com/static/
location /static/ {
proxy_pass http://static_pools;
include proxy.conf;
}
url: https://www.xuliangwei.com/upload/
location /upload/ {
proxy_pass http://upload_pools;
include proxy.conf;
}
}
//Scheme 2: Realize with if statement.
if ($request_uri ~* “^/static/(.)$”)
{
proxy_pass http://static_pools/$1;
}
if ($request_uri ~ “^/upload/(.*)$”)
{
proxy_pass http://upload_pools/$1;
}
location / {
proxy_pass http:/ /default_pools; include proxy.conf; }