代理在Apache中redirect

我有一台运行Apache的OS X服务器,服务于www.mydomain.be

我也有Jira在www.mydomain.be:8080独立运行,我希望能够通过jira.mydomain.be访问Jira。

为了达到这个目的,我补充道:

 <IfModule mod_rewrite.c> RewriteCond %{HTTP_HOST} jira.mydomain.be RewriteRule ^/(.*)$ http://localhost:8080/$1 [P,QSA,L] </IfModule> 

当冲浪到jira.mydomain.comredirect我,但不使用代理。 这就是为什么我在地址栏中inputhttp://localhost:8080

build议?

我将以上内容添加到/etc/apache2/sites下的默认站点configuration中。

 <VirtualHost *:80> ServerAdmin root@localhost DocumentRoot /var/www/html/ ServerName jira.mydomain.be ProxyPreserveHost On ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost> 

不要使用重写规则来代理; 只需在特定的NameVirtualHost使用ProxyPassProxyPassReverse代理Jira实例即可。

例如,closures我的头顶:

 <VirtualHost *:80> ServerName jira.mydomain.be ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>