日期:2014-05-16  浏览次数:20843 次

apache2 同一ip 多域名 虚拟主机配置


apache2 同一ip 多域名 虚拟主机配置

分类: 工作日记 1755人阅读 评论(0) 收藏 举报

最近项目开发用到 apache2+tomcat 遇到一个问题:同一ip?的服务器下有三四个域名指向不同的网站目录,由于以前只是配置虚拟目录,于是百度了一下,试了几个不尽满意,费话少说,贴出来贡献给关注此问题的朋友及贡献给喜欢java开发的朋友.

?关于apache2集成tomcat的配置经验有兴趣的朋友可以问我索取,转入正题.

<VirtualHost *>
DirectoryIndex default.htm default.html index.htm index.html
ServerAdmin site1@163.com
DocumentRoot F:/public_html/site1 ServerName site1.163.com
ErrorLog E:/www_log/site1_log/error_log
CustomLog "|bin/rotatelogs.exe -l E:/www_log/site1_log/access.%Y-%m-%d.log 1G" common
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
#NOTE: Inber modify by 2007.3.20---> Apache don't have permission to access /WEB-INF/ on this server.
<Directory "F:/public_html/site1/WEB-INF">
deny from all
Options None
AllowOverride AuthConfig
Order deny,allow
</Directory>
</VirtualHost>

<VirtualHost *>
DirectoryIndex default.htm default.html index.htm index.html
ServerAdmin site2@163.com
DocumentRoot F:/public_html/site2
ServerName site2.163.com
ErrorLog E:/www_log/site2_log/error_log
CustomLog "|bin/rotatelogs.exe -l E:/www_log/site2_log/access.%Y-%m-%d.log 1G" common
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
#NOTE: Inber modify by 2007.3.20---> Apache don't have permission to access /WEB-INF/ on this server.
<Directory "F:/public_html/site2/WEB-INF">
deny from all
Options None
AllowOverride AuthConfig
Order deny,allow
</Directory>
</VirtualHost>

配置apache +tomcat 时一定要注意web-inf/we