[英]How to map an app from Tomcat8 to Apache in JBoss Web Server?
I install JBoss 3.0.1 and it functions well both Apache on port 80 & Tomcat8 on port 8080. I deploy a sample war file from Tomcat and can view it at http://localhost:8080/sample/ . 我安装了JBoss 3.0.1,它在端口80上的Apache和在端口8080上的Tomcat8都运行良好。我从Tomcat部署了一个示例war文件,可以在http:// localhost:8080 / sample /上查看它。
So is it possible to map it on Apache, then we can access it at http://localhost/sample/ ? 因此可以在Apache上进行映射,然后我们可以在http:// localhost / sample /上进行访问吗? If yes, can you please help me how to do that?
如果是,您能帮我怎么做吗? Any suggestion would be appreciated.
任何建议,将不胜感激。
Update: For POC purpose, the OS is Windows 7 更新:出于POC目的,操作系统为Windows 7
You can do it by means of AJP. 您可以通过AJP来完成。 You don't specify what OS are you using, but I will assume it is GNU/Linux, although instructions for MS Windows will be similar.
您没有指定要使用的操作系统,但我将假定它是GNU / Linux,尽管MS Windows的说明与此类似。
The procedure is the following: 步骤如下:
libapache2-mod-jk
. libapache2-mod-jk
类的东西。 ( In debian/ubuntu you can run sudo apt-get install libapache2-mod-jk
). sudo apt-get install libapache2-mod-jk
)。 jk
or similar. jk
或类似名称的新模块。 You have to enable it ( In debian/ubuntu you can run sudo a2enmod jk
). sudo a2enmod jk
)。 JkWorkersFile
point. JkWorkersFile
指向何处。 This file is needed to configure the workers
that manage communication with tomcat apps. workers
程序。 Sample workers file: 样本工作者文件:
ps=/
worker.list=worker1,worker2,...
# worker1 definition
worker.worker1.port=8009
worker.worker1.host=192.168.1.23
worker.worker1.type=ajp13
# worker2 definition
....
Every worker can point to different tomcat server. 每个工作人员都可以指向不同的tomcat服务器。 Port must be the same that configured into
$CATALINA_HOME/conf/server.xml
. 端口必须与
$CATALINA_HOME/conf/server.xml
中配置的端口相同。 In this file there is a connector for AJP protocol: 在此文件中,有一个用于AJP协议的连接器:
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Every worker has to point to this port. 每个工人都必须指向该端口。
Finally, you can configure virtual host, locations, etc. into Apache with JkMount workerName
to indicate Apache that this url has to be forwarded to the proper worker. 最后,您可以使用
JkMount workerName
将虚拟主机,位置等配置到Apache中,以指示Apache必须将该URL转发给适当的worker。
There are plenty of samples an documentation. 有大量示例文档。 Here you are with Tomcat official docs: https://tomcat.apache.org/connectors-doc/webserver_howto/apache.html
在这里,您将获得Tomcat的官方文档: https : //tomcat.apache.org/connectors-doc/webserver_howto/apache.html
Hope it helps! 希望能帮助到你!
If you are using MS Windows, you can download mod_jk
from this url https://tomcat.apache.org/download-connectors.cgi 如果您使用的是MS Windows,则可以从以下URL下载
mod_jk
:https: mod_jk
Install it and configure as suggested. 安装它并按照建议进行配置。 Due to you want to map this url http://localhost/sample to tomcat app in http://localhost:8080/sample Your configuration must be the following:
由于要将此URL http:// localhost / sample映射到http:// localhost:8080 / sample中的 tomcat应用程序,因此您的配置必须为以下内容:
workers file ( Review port with server.xml
tomcat conf file ): worker文件( 使用
server.xml
tomcat conf文件查看端口 ):
worker.list=worker1
# worker1 definition
worker.worker1.port=8009
worker.worker1.host=localhost
worker.worker1.type=ajp13
Apache Location directive ( Review order, deny and allow to suit your needs ): Apache Location指令( 查看顺序,拒绝并允许其满足您的需求 ):
<Location /sample/>
JkMount worker1
Order deny,allow
Deny from all
Allow from localhost
</Location>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.