Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I know there's a ton of answers to this question out there, but somehow none of them helped me. I have an Ubuntu running 3 webapps, each on different port (8080-8282) - jira, confluence and one more. Now I bought a domain name and bound three subdomains with the IP address of my server, the problem is they all point to the same IP address and to port 80. So I guess I need Apache server now. Now what I want apache to do is to redirect:

Preferably so it won't show the port. From my understanding I should add some lines to /etc/apache2/httpd.conf, and so I tried (this is literally my whole /etc/apache2/httpd.conf):

RewriteEngine on
RewriteCond %{HTTP_HOST} http://jira.mydomain.com/
RewriteRule ^(.*)$ http://jira.mydomain.com:8181 [L,R]
RewriteCond %{HTTP_HOST} http://wiki.mydomain.com/
RewriteRule ^(.*)$ http://wiki.mydomain.com:8080 [L,R]

But it doesn't work (whenever I try for example wiki.mydomain.com I get the default Apache site). So what am I missing here? (I know that to be able to hide the port number I'll have to use a proxy but first I just want to enable the redirect).

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I would attempt to use apache in this way

Use Vhosts and mod_proxy

its quite rough ( dont expect to cut and paste ) :)

<VirtualHost jira.mydomain.com:*>
ProxyPreserveHost On
ProxyPass / http://jira.mydomain.com:8181/
ProxyPassReverse / http://jira.mydomain.com:8181/
ServerName jira.mydomain.com

<VirtualHost wiki.mydomain.com:*>
ProxyPreserveHost On
ProxyPass / http://wiki.mydomain.com:8080/
ProxyPassReverse / http://wiki.mydomain.com:8080/
ServerName wiki.mydomain.com
share|improve this answer
Awesome, did some minor changes and it's all up and running, thanks! –  Zenzen Nov 15 '10 at 9:30
no problem, glad to help :D –  Arenstar Nov 15 '10 at 9:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.