douchun5976 2018-03-09 16:35
浏览 169
已采纳

apache httpd同时处理tomcat和php

I'm setting up a server to handle PHP and Tomcat Java at the same time using port 80, but via different domain.

  1. PHP: abc.yyy.com
  2. Java: def.yyy.com

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. 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?

Thank you.

======================

Answer

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"
  • 写回答

1条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 C语言字符串不区分大小写字典排序相关问题
    • ¥15 关于#python#的问题:我希望通过逆向技术爬取1688搜索页下滑加载的数据
    • ¥15 学习C++过程中遇到的问题
    • ¥15 关于Linux的终端里,模拟实现一个带口令保护的屏保程序遇到的输入输出的问题!(语言-c语言)
    • ¥15 学习C++过程中遇到的问题
    • ¥15 请问,这个嵌入式Linux系统怎么分析,crc检验区域在哪
    • ¥15 二分类改为多分类问题
    • ¥15 Unity微信小游戏上调用ReadPixels()方法报错
    • ¥15 如何通过求后验分布求得样本中属于两种物种其中一种的概率?
    • ¥15 q从常量变成sin函数,怎么改写python代码?