nginx动静分离模板
upstream web.home.org {
server 192.168.1.10:80 weight=1;
server 192.168.1.11:80 weight=2;
server 192.168.1.12:80;
server 192.168.1.13:80;
}
upstream squid.home.org {
server 192.168.1.117:80;
server 192.168.1.118:80;
server 192.168.1.119:80;
}
server {
listen 80;
server_name www.home.org;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location / {
root html;
index index.html index.htm;
if ($request_uri ~* ".*\.(js|css|gif|jpg|jpeg|png|bmp|swf|html)$")
{
proxy_pass http://squid.home.org;
}
if ($request_uri ~* "^/view/(.*)$")
{
proxy_pass http://squid.home.org;
}
proxy_pass http://web.home.org;
}
location /Status {
stub_status on;
access_log on;
}
none