Apache和Tomcat整合配置实现网站目录搭建
?
?
1.配置服务器以允许SSI(Server Side Includes)
1.1 要使服务器允许SSI,必须在httpd.conf
文件或.htaccess
文件中有如下配置:
2.1告诉服务器以允许解析文件中的SSI指令。注意,在多数配置中,多个 ?2.tomcat和Apache整合 2.1 ? 3.配置默认文件使得支持.index.htm,index.html,index.php 3.1在httpd.conf文件中找到 ?代码为 补充:如想通过设置的ServiceName访问网站,必须在本地盘符C:\中搜索host文件,添加如下代码 ?对应设置的ServiceName值 ?提供参考文件,文件包含httpd.conf,worker2.properties和httpd.vhosts ?AddType text/html .shtmlAddOutputFilter INCLUDES .shtml
在httpd.conf文件末尾加入如下内容,用以加载配置好的文件<IfModule ssl_module>SSLRandomSeed startup builtinSSLRandomSeed connect builtin</IfModule>LoadModule jk_module modules/mod_jk.soJkWorkersFile conf/workers2.properties
?在刚建的worker2.properties文件中加入如下内容worker.list=worker1,worker2worker.worker1.port=8009worker.worker1.host=127.0.0.1worker.worker1.type=ajp13worker.worker2.port=8001worker.worker2.host=127.0.0.1worker.worker2.type=ajp13
?其中端口号,对应tomcat发布项目中service配置文件ajp13的端口号,我这里使用俩tomcat发布不同项目产品,其中一个tomcat端口号8070对应ajp13端口号8001,另外一个tomcat端口号8060对应自身ajp13端口号为8009在extra文件夹中的的httpd.vhosts文件中加入如下代码NameVirtualHost *:81
<VirtualHost *:81> JkMount /wasdemo/* worker1 JkMount /wcm/* worker2 ServerAdmin dfreng08@gmail.com DocumentRoot "D:/TRS/TRSWCMV6/WCMData/pub/315" ServerName www.bj315.com ErrorLog "logs/test.log" CustomLog "logs/test-access.log" common <Location /wasdemo>Allow from all </Location> <Location /wcm>Allow from all </Location></VirtualHost>Alias /wcm "D:/TRS/TRSWCMV6/Tomcat/webapps/wcm"Alias /wasdemo "D:/TRS/TRSWAS45/Tomcat/webapps/wasdemo"
?代码具体说明可参考Apache官方说明文档http://httpd.apache.org/docs/2.2/<Directory></Directory>
<Directory /> Options FollowSymLinks MultiViews Includes AllowOverride None Order deny,allow Allow from all AddType application/x-httpd-php .php DirectoryIndex index.htm DirectoryIndex index.php</Directory>
127.0.0.1 www.bj315.com