2022年Apache与Tomcat整合配置[归 .pdf





《2022年Apache与Tomcat整合配置[归 .pdf》由会员分享,可在线阅读,更多相关《2022年Apache与Tomcat整合配置[归 .pdf(22页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Apache 与 Tomcat 整合配置在项目实施过程中,我们经常需要将Web 应用服务器与外网隔离,或者需要多台Web应用服务器作负载平衡。通过apache与 tomcat 整合配置,我们可以很容易实现这些需求。1.Web 应用隔离配置首先下载并安装apache 2.2 以上版本及LiveBOS tomcat 版安装包。打开apache 配置文件 httpd.conf 。将#LoadModule proxy_module modules/mod_proxy.so #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so #LoadModule
2、 proxy_balancer_module modules/mod_proxy_balancer.so 等几行前面的#号去掉。在文件末尾加上ProxyPass / ajp:/XXXX:8009/ 其中 XXXX应该替换为LiveBOS服务器的IP地址,8009 为 tomcat 默认监听ajp 协议的端口,可以按实际环境修改。可按实际要求修改Listen 项配置信息,如Listen 80 等。打开LiveBOS_Tomcat配置文件server.xml,确认 配置项存在并未被注释。当完成这些配置,我们重启apache 及 tomcat 后就可通过apache 监听的端口进行访问了 LiveB
3、OS应用了。为了更好发挥apche 的能力,我们可以把LiveBOS图象等静态文件交给apache 处理。先把 LiveBOS中 Web Content 下 images,GridEx,DHMenu,applets,fckeditor 等几个目录拷贝到apache 配置的虚拟根目录下,默认为htdocs。 (注意:不要直接配置虚拟目录为LiveBOS_Tomcat 中的目录,要不客户端可能会获取整个配置信息).然后在ProxyPass / ajp:/XXXX:8009/ 之前加入ProxyPass /images ! ProxyPass /GridEx ! ProxyPass /DHMenu
4、! ProxyPass /applets ! ProxyPass /fckeditor ! 至此,我们就完成了web 应用隔离配置。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 等几行前面的#号去掉。在文件末尾加上名师资料总结 -
5、- -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 22 页 - - - - - - - - - ProxyPass /images ! ProxyPass /GridEx ! ProxyPass /DHMenu ! ProxyPass /applets ! ProxyPass /fckeditor ! ProxyPass / balancer:/liveboscluster/ lbmethod=byrequests stickysession=JSESSIONID BalancerMembe
6、r ajp:/serverXXXX1:8009 route=lb1 loadfactor=1 BalancerMember ajp:/serverXXXX2:8009 route=lb2 loadfactor=1 . 将 serverXXXX1 ,serverXXXX2替换成实际的应用服务器地址。同时打开serverXXXX1 中tomcat的配置文件server.xml,在Engine 项配置加入jvmRoute=lb1 。如将 改成 并将 serverXXXX2中 server.xml 加入 jvmRoute=lb2, 还有其他服务器的话以此类推. 完成这些配置,重启相应服务器后,我们通过
7、apache 访问就可实现负载均衡了。3.附录下面附录负载均衡配置中httpd.conf 及一个服务器的server.xml 完整配置信息。Httpd.conf: # # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. # In particular, see # # for a discussion of
8、 each configuration directive. # # Do NOT simply read the instructions in here without understanding # what they do. Theyre here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # Configuration and logfile names: If the filenames you specify for many #
9、 of the servers control files begin with / (or drive:/ for Win32), the # server will use that explicit path. If the filenames do *not* begin # with /, the value of ServerRoot is prepended - so logs/foo.log # with ServerRoot set to D:/ApacheGroup/Apache2.2 will be interpreted by the 名师资料总结 - - -精品资料欢
10、迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 22 页 - - - - - - - - - # server as D:/ApacheGroup/Apache2.2/logs/foo.log. # # NOTE: Where filenames are specified, you must use forward slashes # instead of backslashes (e.g., c:/apache instead of c:apache). # If a drive letter is
11、omitted, the drive on which Apache.exe is located # will be used by default. It is recommended that you always supply # an explicit drive letter in absolute paths, however, to avoid # confusion. # # ThreadsPerChild: constant number of worker threads in the server process # MaxRequestsPerChild: maxim
12、um number of requests a server process serves ThreadsPerChild 250 MaxRequestsPerChild 0 # # ServerRoot: The top of the directory tree under which the servers # configuration, error, and log files are kept. # # Do not add a slash at the end of the directory path. If you point # ServerRoot at a non-lo
13、cal disk, be sure to point the LockFile directive # at a local disk. If you wish to share the same ServerRoot for multiple # httpd daemons, you will need to change at least LockFile and PidFile. # ServerRoot D:/ApacheGroup/Apache2.2 # # Listen: Allows you to bind Apache to specific IP addresses and/
14、or # ports, instead of the default. See also the # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) # #Listen 12.34.56.78:80 Listen 80 # # Dynamic Shared Object (DSO) Support # # To be able to use the
15、 functionality of a module which was built as a DSO you # have to place corresponding LoadModule lines at this location so the # directives contained in it are actually available _before_ they are used. # Statically compiled modules (those listed by httpd -l) do not need 名师资料总结 - - -精品资料欢迎下载 - - - -
16、 - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 22 页 - - - - - - - - - # to be loaded here. # # Example: # LoadModule foo_module modules/mod_foo.so # LoadModule actions_module modules/mod_actions.so LoadModule alias_module modules/mod_alias.so LoadModule asis_module modules/mod_asis.so Loa
17、dModule auth_basic_module modules/mod_auth_basic.so #LoadModule auth_digest_module modules/mod_auth_digest.so #LoadModule authn_anon_module modules/mod_authn_anon.so #LoadModule authn_dbm_module modules/mod_authn_dbm.so LoadModule authn_default_module modules/mod_authn_default.so LoadModule authn_fi
18、le_module modules/mod_authn_file.so #LoadModule authz_dbm_module modules/mod_authz_dbm.so LoadModule authz_default_module modules/mod_authz_default.so LoadModule authz_groupfile_module modules/mod_authz_groupfile.so LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_user_module
19、modules/mod_authz_user.so LoadModule autoindex_module modules/mod_autoindex.so #LoadModule cern_meta_module modules/mod_cern_meta.so LoadModule cgi_module modules/mod_cgi.so #LoadModule dav_module modules/mod_dav.so #LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule deflate_module modules/m
20、od_deflate.so LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so #LoadModule expires_module modules/mod_expires.so #LoadModule file_cache_module modules/mod_file_cache.so #LoadModule headers_module modules/mod_headers.so LoadModule imagemap_module modules/mod_imagemap.
21、so LoadModule include_module modules/mod_include.so #LoadModule info_module modules/mod_info.so LoadModule isapi_module modules/mod_isapi.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so #LoadModule mime_magic_module modules/mod_mime_magic.so LoadM
22、odule 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_http_module modules/mod_proxy_http.so #LoadModule proxy_ftp_modu
23、le modules/mod_proxy_ftp.so LoadModule negotiation_module modules/mod_negotiation.so 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 22 页 - - - - - - - - - #LoadModule rewrite_module modules/mod_rewrite.so LoadModule setenvif_module modules/mod_setenvif.so #Load
24、Module speling_module modules/mod_speling.so #LoadModule status_module modules/mod_status.so #LoadModule unique_id_module modules/mod_unique_id.so LoadModule userdir_module modules/mod_userdir.so #LoadModule usertrack_module modules/mod_usertrack.so #LoadModule vhost_alias_module modules/mod_vhost_a
25、lias.so #LoadModule ssl_module modules/mod_ssl.so # Main server configuration # # The directives in this section set up the values used by the main # server, which responds to any requests that arent handled by a # definition. These values also provide defaults for # any containers you may define la
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年Apache与Tomcat整合配置归 2022 Apache Tomcat 整合 配置

限制150内