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: