server {
listen 80;
server_name 123.com;
root /var/www/web/123;
index index.html index.htm index.php;
rewrite ".*" http://456.com permanent;}
server {
server_name 123.com;
location ~ .*.(gif|jpg|png|htm|html|flv|ico|swf)(.*) {
proxy_pass http://456.com;
proxy_redirect off;
proxy_set_header Host $host;
proxy_cache cache_one;
proxy_cache_valid 200 302 1h;
proxy_cache_valid 301 1d;
proxy_cache_valid any 1m;
expires 30d;
}
location / {
proxy_next_upstream off;
proxy_connect_timeout 50s;
proxy_send_timeout 50s;
proxy_read_timeout 50s;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://456.com;
}
}