Windows installation Nginx Deployment Step diagram (reverse agent and load balancing) _nginx

Source: Internet
Author: User
Tags nginx reverse proxy

Download and install Nginx (this is the Windows XP 32bit environment)

Unpack Nginx-1.0.11.zip, enter nginx-1.0.11, and execute commands on the command line to allow Nginx to start. The following figure:

Test if the installation was successful, enter address: http://localhost:8090

The browser displays the results as shown below:

Ok,nginx deployment was successful.

Second, about the Nginx reverse proxy configuration.

A reverse proxy (Reverse proxy) means to accept a connection request on the Internet with a proxy server, then forward the request to a server on the internal network and return the results obtained from the server to the client requesting the connection on the Internet, At this point, the proxy server behaves as a server.

About Nginx configuration reverse proxy to configure, to Baidu Google as an example, the configuration file nginx.conf (path: D:\Nginx\nginx-1.0.11\nginx-1.0.11\conf) configuration content as follows:

Copy Code code as follows:

Location/baidu {
Proxy_pass http://www.google.com;
Proxy_set_header Host $host;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}


where "/baidu" is mapped to "http://www.google.com".

Test access: Http://localhost:8090/baidu

Access results:

Although the interface display error, the effect has been achieved.

Third, load balance test.

Existing two tile service addresses, with Nginx to do a load balancing, the configuration file is as follows:

Copy Code code as follows:

Upstream Cluster {
Server 192.98.12.60:1985 weight=3 max_fails=2 fail_timeout=30s;
Server 192.98.12.42:8086 weight=3 max_fails=2 fail_timeout=30s;
}
server {
Listen 8090;
server_name localhost;
#charset Koi8-r;
#access_log Logs/host.access.log Main;
Location/{
root HTML;
Index index.html index.htm;
}
Location/tileservice {
Proxy_pass Http://cluster/MongoTileService/tileService;
Proxy_set_header Host $host;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
}


Once configured, restart (nginx-s reload) address: http://192.98.12.60:8090/tileservice?type=vec_c&x=104&y=17&l=7 can get the service picture:

Related Article

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.