开发者

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). I have Apache running on the machine port 80. I need to direct the request to appropriate context based on the application being accessed.

I have a dns entry - testServ14, which points to the server IP.

To be more clear, the applications should be accessible via urls something like

http://testServ14/appAcontext/

http://testServ14/appBcontext/

In httpd-vhosts file what should i be using virtualhost or namevirtualhost directives?

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://local开发者_JS百科host: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>


If you want to redirect from one url to another, then what you need to use is mod_rewrite.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜