nginx请求转发备注

我想根据请求的地址来做转发:
比如请求: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;
}

[color=orange]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;

}[/color]


------------------------------根据访问地址确定访问应用----------------------------------
server{
listen 80;
server_name tcrm.hupun.com;

location / {
proxy_pass http://127.0.0.1:5180/;
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 /crm.open {
index index.html;
proxy_pass http://127.0.0.1:8380/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值