Wildfly侦听端口8080和端口80上的httpd,并在URL上没有端口号8080重定向

时间:2017-03-28 17:30:03

标签: apache centos7

AWS CentOS 64b / HTTP / Wildfly 10 / PHPBB php论坛/ java项目

情景:

我的网址是:www.apisani.org

我在端口80上有httpd监听

我有Wildfly侦听端口8080

我的需求:我需要输入浏览器:www.apisani.org并重定向到wildfly - 端口8080上的java应用程序,但不想在URL中显示端口号。< / p>

我需要输入浏览器:www.forum.apisani.org并重定向到端口80上的httpd - phpbb论坛网站。

我知道如何在standalone.xml和welcome-content中设置wildfly以将www.apisani.org重定向到www.apisani.org/app/indexapp.xhtl,但问题在上面给出了&#34;我的需求&# 34;节

[基于鱼类更新的更新...]

我们快到了! <virtualHost>就像魅力一样!

:( ReWriteConde重定向到wildfly网址应用而非论坛...

RewriteCond %{HTTP_HOST} ^www\.forum\.apisani\.org$
RewriteRule (.*) http://apisani.org:80/phpBB3/$1 [P,L]

RewriteCond %{HTTP_HOST} ^forum\.apisani\.org$
RewriteRule (.*) http://apisani.org:80/phpBB3/$1 [P,L]

<VirtualHost *:80>
  Servername www.apisani.org
  ServerAlias apisani.org

  ProxyPreserveHost on
  ProxyPass  / http://apisani.org:8080/app/index
  ProxyPassReverse / http://apisani.org:8080/app/index
</VirtualHost>

1 个答案:

答案 0 :(得分:1)

我建议使用重写和[P]:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www.apisani.org$
RewriteRule (.*) http://wildfly:8080/$1 [P,L]

RewriteCond %{HTTP_HOST} ^www.forum.apisani.org$
RewriteRule (.*) http://phpbb-forum-website:80/$1 [P,L]

$ 1指(。*) - &gt;整个URI。如果您想将其传递给您的应用程序。如果没有,只需丢失括号和$ 1

如果您正在寻找,请告诉我们。如果没有,甚至更多,所以我们可以进一步提供帮助;)

<强>更新

RewriteCond %{REQUEST_URI} !^/php
RewriteCond %{HTTP_HOST} ^(www\.)?apisani\.org$
RewriteRule ^/(.*)$ apisani.org:8080/<path> [P,L]

RewriteCond %{HTTP_HOST} ^(www\.)?forum\.apisani\.org$
RewriteRule ^/(.*)$ apisani.org/<path> [P,L]
相关问题