Windows Nginx configures response agent (same NG Port) based on request address

Source: Internet
Author: User

#user nobody;

Worker_processes 1;


#error_log Logs/error.log;

#error_log Logs/error.log Notice;

#error_log Logs/error.log Info;


#pid Logs/nginx.pid;



Events {

Worker_connections 1024;

}



HTTP {

Include Mime.types;

Default_type Application/octet-stream;

Sendfile on;

Keepalive_timeout 65;


Upstream driver-interface{

server ip1:8081 max_fails=0;

#server ip2:8082 max_fails=0;

}


Upstream driver-admin{

#server 218.66.19.173:8081 max_fails=0;

Server 192.168.3.21:8082 max_fails=0;

}


server {

Listen 80;

server_name localhost;


location/drive/mobile/{//Here Control Interface (MOBILE) proxy jump

root HTML;

Proxy_redirect off;

Proxy_set_header Host $host: 80;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Index index.html index.htm;

Proxy_pass Http://driver-interface;

proxy_redirect default;

}

Location ~ */(Admin|js|css|img|images) {//Here control Management background (admin) proxy jump, because background has style, JS and picture, prefix does not include admin. So it needs to be configured here

root HTML;

Index index.html index.htm;

is to re-forward the requested domain name to the page (paging, or directly get the request domain name needs, if not configured to read to Http://driver-interface)

Proxy_redirect off;

Proxy_set_header Host $host: 80;

Proxy_set_header X-real-ip $remote _addr;

Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;

Proxy_pass http://driver-admin;

proxy_redirect default;

}


Location/{

root HTML;

Index index.html index.htm;

}


Error_page 502 503 504/50x.html;

Location =/50x.html {

root HTML;

}


}


}


Windows Nginx Configures response agent (same NG Port) based on request address

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.