1.同时监听多个端口
Listen 8078
Listen 8088
2.启用代理
LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
3.虚拟主机反向代理
NameVirtualHost *:80<VirtualHost *:80>
ServerName 192.168.1.250
ProxyRequests off
ProxyPass / http://192.168.1.250/
ProxyPassReverse / http://192.168.1.250/
</VirtualHost>
NameVirtualHost *:8080<VirtualHost *:8080>
ServerName 192.168.100.250
ProxyRequests off
ProxyPass / http://192.168.100.250/
ProxyPassReverse / http://192.168.100.250/
</VirtualHost>
不用虚拟主机做反向代理
<IfModule mod_proxy.c>
ProxyRequests off<Proxy /ps>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /http://192.168.0.2:8080/
ProxyPassReverse /http://192.168.0.2:8080/
</IfModule>
#tomcat支持
LoadModule jk_module modules/mod_jk-apache-2.2.4.so
JkWorkersFile conf/workers.properties
#所有servlet都指向ajp13
JkMount /*servlet/* ajp13
#所有JSP都指向ajp13
JkMount /*.jsp ajp13
JkMount /*.action ajp13
JkMount /*.do ajp13
3.虚拟主机
NameVirtualHost *:8088
<VirtualHost *:8088>
DocumentRoot d:/wwwroot/
ServerName 50.0.180.20:8088
#ServerAlias test
<Directory "d:/wwwroot/">
AllowOverride All
Options -Indexes FollowSymLinks
#禁止浏览目录
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
NameVirtualHost *:8078
<VirtualHost *:8078>
#对所有8078端口代理
ServerName 192.168.100.250:8078
ProxyPass / http://192.168.100.250/
ProxyPassReverse / http://192.168.100.250/
</VirtualHost>
5.workers.properties文件配置
[shm]
info=Scoreboard. Requried for reconfiguration and status with multiprocess servers.
file=anon
# Defines a load balancer named lb. Use even if you only have one machine.
[lb:lb]
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=127.0.0.1
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
group=lb
# Map the Tomcat examples webapp to the Web server uri space
[uri:/examples/*]
group=lb
[status:]
info=Status worker, displays runtime information
[uri:/jkstatus/*]
info=The Tomcat /jkstatus handler
group=status:
声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。