nginx配置文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream static_pools {
server 122.114.96.142:8080;
}
upstream dynamic_pools {
server 122.114.96.143:8080;
}
server {
listen 80;
location / {
root html;
index index.html index.htm;
proxy_pass http://dynamic_pools;
}
location ~ .*.(gif|jpg|jpeg|png|bmp|swf|css|js)$ { //如果请求包含这些后缀,请求被转发到静态池,否则转发到动态池
proxy_pass http://static_pools;
}
}
}
./nginx -s reload 加载配置
访问测试。