##httpd.conf 配置 ####以下module需要引入
- mod_proxy
- mod_proxy_connect
- mod_proxy_http -mod_rewrite
可能没有写全,这个网上很多。
##具体的配置
NameVirtualHost *:8088
<VirtualHost *:8088>
ServerName localhost
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
ProxyPass /osmpweb http://localhost:8082/osmpweb
ProxyPassReverse /osmpweb http://localhost:8082/osmpweb
ProxyPass /osmpapi2 http://localhost:8083/osmpapi2
ProxyPassReverse /osmpapi2 http://localhost:8083/osmpapi2
ProxyPass /exam http://localhost:8084/exam
ProxyPassReverse /exam http://localhost:8084/exam
ProxyPass /w1000 http://localhost:8081/w1000
ProxyPassReverse /w10000 http://localhost:8081/w1000
ProxyPass /a1000 http://localhost:8080/a1000
ProxyPassReverse /a1000 http://localhost:8080/a1000
#ErrorLog "|bin/rotatelogs.exe logs/te/error.%Y-%m-%d.log 5M"
#CustomLog "|bin/rotatelogs.exe logs/te/access.%Y-%m-%d.log 5M" common env=!dontlog
</VirtualHost>
最简单的配置,没有配置日志及其他 ##路径问题 之前的项目都是放在一个tomcat里面对应不同的路径,换成apache以后,每个项目一个tomcat,如: http://localhost:8080/exam 由于之前的项目的路径是用的tomcat的绝对路径,如果把项目放在tomcat的ROOT下面,路径会出错。
所以使用 ProxyPass /exam http://localhost:8080/exam
这种方式,apache把exam这个路径转发到tomcat的exam路径。就可以解决路径的问题。 ###安装到windows服务
默认安装方式:httpd.exe -k install
自定义服务名:httpd.exe -k install -n "MyServiceName"