nginx中配置域名跳转示例

来源:互联网 发布:poi数据统计 编辑:程序博客网 时间:2024/06/01 08:40

nginx中配置域名跳转示例

如访问http://a.qing.com/abc 时跳转到http://aaaaa.qing.com/www/ccccc?p=abc


    server {
        listen  80;

        server_name  a.qing.com ;

access_log  /usr/local/nginx/logs/uyeepay.log  access;
rewrite ^/([0-9a-z]+)$ http://aaaaa.qing.com/www/ccccc?p=$1 last;
    }


如访问http://www.minjietong.com时跳转到http://www.minjietong.com/mjt/index.do


 server {
listen       80;
server_name  www.minjietong.com;


rewrite ^/?$ /mjt/index.do redirect;


location ~ ^/mjt/
{
index index.action index.jsp client.html;
proxy_set_header x-forwarded-for  $remote_addr;
proxy_pass http://112.13.253.17:8080;
}
}


server {
listen       80;
server_name  m.minjietong.com;

rewrite ^/?$ /mjt/wap/index.do last;

location ~ ^/mjt/
{
index index.action index.jsp client.html;
proxy_set_header x-forwarded-for  $remote_addr;
proxy_pass http://112.13.253.17:8080;
}
}

原创粉丝点击