1.下载tomcat,配置conf/server.xml,在Host节点下添加Context节点,指定程序目录:
说明:path为虚拟目录,docBase为程序的实际目录。
2.下载nginx,放在tomcat目录下。配置conf/nginx.conf文件:server { listen 11100; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; #location / { # root html; # index index.html index.htm; #} location / { proxy_pass http://localhost:8080/ol/; } location /geoserver/ { proxy_pass http://localhost:8082/geoserver/; client_max_body_size 2048M; proxy_connect_timeout 1800; proxy_send_timeout 1800; proxy_read_timeout 1800; send_timeout 1800; proxy_ignore_client_abort on; }}
配置详解:
listen为监听端口,
server_name为服务名称,
上面配置的访问地址为;
location配置映射路径,
"location /"表示请求根目录的映射,访问实际被映射为
;"proxy_ignore_client_abort on"表示客户端不主动断开连接;
proxy_connect_timeout连接超时时间;
proxy_send_timeout为发送超时时间;
proxy_read_timeout指令设置与代理服务器的读超时时间。它决定了nginx会等待多长时间来获得请求的响应;send_timeout。
参考文献: