我想根据请求的地址来做转发:
比如请求:www.mydomon.com/scm_sample 那么扔到另一台机器上.
server {
listen 80;
server_name wwww.hupun.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location ~ ^/scm/(images|pages|javascript|js|css|flash|media|static)/ {
root /home/apache-tomcat-7.0.22/webapps;
# expires 30d;
}
location ~ ^/scm/(.*.jpg|.*.gif|.*.png|.*.bmp)/ {
root /home/apache-tomcat-7.0.22/webapps;
}
location /scm {
index sys.index.d;
proxy_pass http://127.0.0.1:8080$request_uri;
}
location /scm_sample {
set $fixed_destination $http_destination;
if ($http_destination ~* ^https(.*)$){
set $fixed_destination http$1;
}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Destination $fixed_destination;
proxy_pass http://111.11.111.111$request_uri;
}