[英]apache httpd handling tomcat and php at same time
I'm setting up a server to handle PHP and Tomcat Java at the same time using port 80, but via different domain. 我正在设置服务器,以使用端口80同时通过不同域同时处理PHP和Tomcat Java。
Both domain has already pointed to this server and working fine. 两个域都已经指向该服务器并且可以正常工作。
So far using the same Apache httpd, I can already access either my tomcat using mod_jk, or my php using the php handler. 到目前为止,使用相同的Apache httpd,我已经可以使用mod_jk访问tomcat或使用php处理程序访问我的php。 But I can only access one of them at a time.
但是我一次只能访问其中一个。
include C:/apache-tomcat-7.0.85/conf/mod_jk.conf
<VirtualHost def.yyy.com:8082>
ServerName def.yyy.com
JkMount /* worker1
</VirtualHost>
# if i comment everything above this line, my php below works well,
# but if I don't, everything is redirected to tomcat above
LoadModule php7_module "C:/PHP72/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/PHP72"
Does anyone know if there's a setting to force abc.yyy.com to be handled by php engine, and def.yyy.com to be handled via mod_jk? 有谁知道是否有一个设置来强制abc.yyy.com由PHP引擎处理,而def.yyy.com由mod_jk处理?
Thank you. 谢谢。
====================== ======================
In case if anyone is here browsing for answer, here's the working config: 如果有人在这里浏览答案,请使用以下配置:
include C:/apache-tomcat-7.0.85/conf/mod_jk.conf
<VirtualHost *:8082>
ServerName def.yyy.com
JkMount /* worker1
</VirtualHost>
<VirtualHost *:8082>
ServerName abc.yyy.com
DocumentRoot "C:/Program Files/Apache24/htdocs"
</VirtualHost>
LoadModule php7_module "C:/PHP72/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/PHP72"
You can for sure using different ports: Can a single Apache server handle both Tomcat and PHP? 您可以确定使用不同的端口: 单个Apache服务器可以同时处理Tomcat和PHP吗?
Honestly, don't know if you can listen on the same port tho. 老实说,不知道您是否可以在同一端口上收听。
EDIT 编辑
Yes, you can: https://sites.google.com/a/ci2s.com.ar/wiki/technics/how-to-run-apache-httpd-and-tomcat-on-port-80-using-mod-proxy 是的,您可以: https : //sites.google.com/a/ci2s.com.ar/wiki/technics/how-to-run-apache-httpd-and-tomcat-on-port-80-using-mod -代理
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.