Please ask the nginx agent for forwarding and a complete online information, please!
某草草
某草草 2017-06-26 10:49:59
0
1
854

The current situation is like this, my nginx is configured!
But I am not familiar with forwarding, and I have not been successful in finding information!

I have A domain name www.a.cn main website

Then the request from main site A has to go to sites B and C. Since the second-level domain name is cross-domain, please complete the front-end and back-end requests!

I want to forward
www.a.cn/api/xxx/xx
to
api.a.cn/api/xxx/xx

Forward
www.a.cn/user/xxx/xx
to
api.a.cn/user/xxx/xx

Forward
www.a.cn/mch/xxx/xx
to
mch.a.cn/mch/xxx/xx

Thank you everyone, who has complete nginx configuration information online?

某草草
某草草

reply all(1)
洪涛
server {
    listen 80;
    server_name www.a.cn;
    index index.html index.htm index.php;
    root 网站根目录;
    
    location /api {
       proxy_pass http://api.a.cn;
    }
    
    location /user {
        proxy_pass http://api.a.cn;
    }
    
    location /mch {
        proxy_pass http://mch.a.cn;
    }
}

Try it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template