Configuring reverse proxy by Apache
|
Feedback
|
Startup Apache
- Install Apache to the specified directory.
- After Apache is installed, it is in the startup status by default. You can set the status of "Start", "Stop", "Restart" by clicking the icon
on the bottom-right corner of your screen.
- To verify the start status of Apache, there are two ways:
- Open Task Manager to check whether the thread of Apache starts or not.
- If the web page appears "It works!" when you access http://127.0.0.1 or http://localhost, this mean that the Apache has been successfully installed.
Configure Apache
Basic configuration
Go to [Apache install]\conf\, and open the httpd.conf file. You can change the contents to realize the configuration of reverse proxy:
- Remove the annotation "#" from the following two lines:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
- Add new contents at the end:
ProxyPass /iserver http://192.168.17.16:8090/iserver
ProxyPassReverse /iserver http://192.168.17.16:8090/iserver
- ProxyPass: It is used to set the GIS service URL which needs to forward. It can be the IP address or the domain.
- ProxyPassReverse: Both of ProxyPassReverse and ProxyPass should appear in pairs.
Request header of forward configuration
On the basis of the configuration above, the URL for forwarding in the request header should be set, too. Because if you don't set this URL, you still go to the original GIS server while you access to the reverse proxy server. There are three methods for setting the forwarding:
- Method One: Set ProxyPreserveHost. Under [Apache installation]\conf\httpd.conf, set ProxyPreserveHost to ON.
- Method Two: Set ProxyHost by the mod_headers plugin. There are two steps:
- First, open mod_headers, remove the annotation "#" in the httpd.conf file:
LoadModule headers_module modules/mod_headers.so
- Then, set ProxyHost in this file:
RequestHeader set ProxyHost "supermap.iserver.org:8000"
- Method Three: Modify the iServer configure file. Go to [SuperMap iServer Installation]\webapps\iserver\WEB_INF\iserver-system.xml, add a line under the <properties> node:
<proxyHost>supermap.iserver.org:8000</proxyHost>
Access services
Before visiting http://supermap.iserver.org:8000/iserver, you should assign supermap.iserver.org a specified IP. So, you can set the IP via DNS; Or, you can add "192.168.17.16 supemap.iserver.org" to C:\Windows\System32\drivers\etc\hosts. After the IP is configured, you can get the same GIS services from the reverse proxy server at http://supermap.iserver.org:8090/iserver.