1、下载nginx软件:官网地址http://nginx.org/
2、修改conf文件夹下nginx.conf配置信息,
配置文件中以下内容:
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
按需要改为如下:
upstream arcgis{
server 192.168.100.190:8399; //代理的arcgis server服务器的地址和端口号
}
server {
listen 8048; //反向代理后的端口号
server_name localhost;
location / {
proxy_pass http://arcgis ;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_next_upstream error timeout invalid_header http_500 http_504 http_404;
}
3、启动nginx,使dos命令,定位到nginx目录下,使用“start nginx.exe”启动nginx。
4、验证:
以服务目录http://192.168.100.190:8399/arcgis/rest/services,nginx部署到192.168.100.223服务器为例。
部署成功后,访问http://192.168.100.190:8399/arcgis/rest/services,访问结果应与http://192.168.100.233:8048/arcgis/rest/services访问结果一致。
PS:使用nginx还可以配置负载均衡,可参考牛魔王的帖子http://blog.csdn.net/warrenwyf/article/details/5703098