【问题标题】:pointing the website from tomcat to the Apache server将网站从 tomcat 指向 Apache 服务器
【发布时间】:2011-09-29 10:58:33
【问题描述】:
我在 Apache 服务器上有一个网站 website1.com,使用 PHP 开发并部署在 Apache 服务器中。
现在我已经在 Java 和 JSP 技术中实现了一个新功能/模块,并部署在 Tomcat 服务器中。
现在我在 Java J2EE 技术中实现的内容应该指向实际网站 website1.com 的子域,它应该看起来像 subdomain1.website1.com
Apache Tomcat 和 Apache Server 都驻留在同一台机器上。
这可能吗?如果是,你能帮我怎么做吗?
所有环境都设置在基于LINUX的服务器上。
【问题讨论】:
标签:
java
php
apache
web-applications
tomcat
【解决方案1】:
您可以尝试使用带有代理通过规则的虚拟主机。配置的核心是:
NameVirtualHost *:80
# Default host to handle PHP and static content
<VirtualHost *:80>
DocumentRoot /var/www/www.website1.com
ServerName www.website1.com
# Other directives here
</VirtualHost>
# Tomcat redirector
<VirtualHost *:80>
DocumentRoot /var/www/subdomain1.website1.com
ServerName subdomain1.website1.com
# Other directives here
ProxyPass / ajp://website1.com:8009
</VirtualHost>
假设您在 Tomcat 配置中启用了 AJP 连接器,并且它在端口 8009 上运行。