简体   繁体   English

Apache Web服务器,在同一服务器上的不同端口中的多个应用程序

[英]Apache web server, multiple applications in different ports with on same server

I have two applications running on Jboss 6 with different context on same port (8180). 我在Jboss 6上运行了两个应用程序,在同一个端口上有不同的上下文(8180)。 I have Apache running on the machine port 80. I need to direct the request to appropriate context based on the application being accessed. 我在机器端口80上运行Apache。我需要根据所访问的应用程序将请求定向到适当的上下文。

I have a dns entry - testServ14, which points to the server IP. 我有一个dns条目 - testServ14,它指向服务器IP。

To be more clear, the applications should be accessible via urls something like 为了更清楚,应该可以通过URL等方式访问应用程序

http://testServ14/appAcontext/ HTTP:// testServ14 / appAcontext /

http://testServ14/appBcontext/ HTTP:// testServ14 / appBcontext /

In httpd-vhosts file what should i be using virtualhost or namevirtualhost directives? 在httpd-vhosts文件中,我应该使用virtualhost或namevirtualhost指令?

How can I achieve this.. 我怎样才能做到这一点..

Tried the following but did not work... 试过以下但没有奏效......

<VirtualHost *:80>
ServerName http://testServ14/appA
ProxyRequests Off
ProxyVia On
ProxyPass / http://localhost:8180/appA
ProxyPassReverse / http://localhost:8180/appA
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>


<VirtualHost *:80>
ServerName http://testServ14/appB
ProxyRequests Off
ProxyVia On
ProxyPass / http://localhost:8180/appB
ProxyPassReverse / http://localhost:8180/appB
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>

Thanks 谢谢

-- updated

The following works nicely...you can add other apps with a different context,running on the same port. 以下工作很好...您可以添加具有不同上下文的其他应用程序,在同一端口上运行。

<VirtualHost *:80>
ServerName http://us14testServ/
ServerAlias us14testServ
ProxyRequests Off
ProxyVia On

#app1
ProxyPass /app1/ http://localhost:8180/app1/
ProxyPassReverse /app1/ http://localhost:8180/app1/

#app2
ProxyPass /app2/ http://localhost:8180/app2/
ProxyPassReverse /app2/ http://localhost:8180/app2/

ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>

如果要从一个url重定向到另一个url,那么你需要使用的是mod_rewrite

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM