单个Apache服务器可以同时处理Tomcat和PHP吗?

编程入门 行业动态 更新时间:2024-10-27 18:29:27
本文介绍了单个Apache服务器可以同时处理Tomcat和PHP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要求在同一个Apache上运行同时具有Java应用程序和PHP应用程序的单个服务器。这可能吗?

这个问题可能非常愚蠢,但我对java要求或安装程序一无所知。

<我可以做同样的事情,让java应用程序在一个端口上运行,而PHP应用程序在另一个端口上运行,两者都在同一个Apache上吗?

解决方案

是的,你可以做到这一点。基本上你必须在一个端口上运行Apache(+ PHP)服务器,在另一个端口上运行Tomcat服务器。

  • 你可以将第二个端口暴露给外界,并让您的URL使用端口 80 用于Apache / PHP或(比如) 8080 用于Java服务器。这很简单,但您可能会发现上游防火墙阻止远程Web浏览器连接到 80 以外的任何端口。

  • 您可以将Apache服务器配置为Java服务器的反向代理。因此,例如,Apache服务器可能会识别 site/javaapp/foo.html 是针对Java服务器的,并将该URL的请求转发给 http:// localhost:8080 / javaapp / foo.html 。

关于使用mod_proxy配置正向和反向代理的Apache文档有一整章。

I have a requirement as to have a single server with both a Java application and a PHP application, running on the same Apache. Is this possible?

This question may be very silly but I have no clue about java requirements or installation procedures.

Can I do such a thing that as to have the java application running on one port and the PHP application on another port, both on the same Apache?

解决方案

Yes you can do that. Essentially you have to run the Apache (+ PHP) server on one port and the Tomcat server on a different port.

  • You can expose the 2nd port to the outside world, and have your URLs use either port 80 for Apache / PHP or (say) 8080 for the Java server. This simple, but you may find that upstream firewalls prevent a remote web browser from connecting to any port other than 80.

  • You can configure your Apache server as a reverse proxy for the Java server. So for instance, the Apache server might recognize that site/javaapp/foo.html is for the Java server, and relay requests for that URL to localhost:8080/javaapp/foo.html.

There is a whole chapter of the Apache documentation about configuring forward and reverse proxies using mod_proxy.

更多推荐

单个Apache服务器可以同时处理Tomcat和PHP吗?

本文发布于:2023-08-07 13:38:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319343.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   Apache   PHP   Tomcat

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!