Apache Web 服务器,同一服务器上不同端口的多个应用程序
我有两个应用程序在 Jboss 6 上运行,在同一端口 (8180) 上具有不同的上下文。我在机器端口 80 上运行 Apache。我需要根据正在访问的应用程序将请求定向到适当的上下文。
我有一个 dns 条目 - testServ14,它指向服务器 IP。
更清楚地说,应用程序应该可以通过类似于
http://testServ14/appAcontext/
http://testServ14/appBcontext/
在 httpd-vhosts 文件中我应该使用 virtualhost 或 namevirtualhost指令?
我怎样才能实现这个..
尝试了以下但没有工作...
<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>
谢谢
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://localhost:8180/appB
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下效果很好......您可以添加具有不同上下文的其他应用程序,在同一端口上运行。
The following works nicely...you can add other apps with a different context,running on the same port.
如果你想从一个网址重定向到另一个网址,那么你需要使用 mod_rewrite 。
If you want to redirect from one url to another, then what you need to use is mod_rewrite.