Home  >  Q&A  >  body text

About the integration of apache and tomcat

The company website is written in jsp
The company's official account is written in php
One uses apache and the other uses tomcat
How to share the two ports to port 80?
Or jsp requests are distributed to tomcat for processing
Most of the ones on the Internet use the mod_jk module. This module has not supported the new version of apache a long time ago.
Is there any use of the proxy module? If so, please give details. Described method
Environment
centOS6.5
apache2.2
tomcat7
jdk1.7

我想大声告诉你我想大声告诉你2713 days ago491

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:01:06

    nginx as a reverse proxy can help you.
    php is forwarded to apache, and java is forwarded to tomcat.


    apache IP 192.168.1.101
    tomcat IP 192.168.1.102

    nginx configuration

    server {
    listen      80;
    server_name www.a.com;
    index index.html index.php index.jsp;
    root        /home/www/www.a.com;
    access_log  /var/log/nginx/a_access.log main;
    
    location ~ \.php$ {
            proxy_pass 192.168.1.101;
     }
    
    location ~ \.jsp$ {
            proxy_pass 192.168.1.102;
     }
    }
    

    The dividing line is not displayed on the computer, but it is displayed on the mobile phone. I struggled for a whole afternoon...

    reply
    0
  • Cancelreply