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

I have an apache2 running and i have a service available as http://www.domain.com:8080/sitename

What will be a simplest apache2 configuration so entering "http://www.domain.com" in browser will show "http://www.domain.com:8080/sitename"? I have added:

<VirtualHost *:80>
  ProxyPass / http://www.domain.com:8080/sitename/
  ProxyPassReverse / http://www.domain.com:8080/sitename/
</VirtualHost>

But, of course, this is not workig. Is it some simple configuration i can use for such redirect or i'm doomed to copy-paste a 100+ line configs from tutorials?

share|improve this question

4 Answers 4

up vote 2 down vote accepted

I think you are almost there try adding

ProxyRequests Off
<Proxy *>
    Order deny,allow
    allow from all
 </Proxy>
 ProxyPreserveHost On

to your VirtualHost definition

share|improve this answer
    
1) Default: ProxyRequests Off 2)your answer is no different from my –  alvosu Jan 30 '11 at 15:06
    
@alvosu: 1. Better to be safe than sorry with some things. 2. That happens a lot here - you'll get used to it. –  Iain Jan 30 '11 at 15:23

My working config(ubuntu 10.04):

<VirtualHost *:80>
  ProxyPass / http://www.domain.com:8080/sitename/
  ProxyPassReverse / http://www.domain.com:8080/sitename/
  ProxyPreserveHost On

  <proxy>
    Order deny,allow
    Allow from all
  </proxy>

</VirtualHost>
share|improve this answer
    
Thanks. Using this and adding mod_proxy_http solves the problem –  Eye of Hell Jan 30 '11 at 15:11

That looks good. Check your error log. Do you have both mod_proxy and mod_proxy_http loaded? You should also have "ProxyRequests Off" to prevent you from becoming a forward proxy

share|improve this answer
    
Default: ProxyRequests Off –  alvosu Jan 30 '11 at 15:07

The <proxy> statement is for a 'forward' proxy, which allows requests for any url on the web.

Loading mod_proxy_http and using 'ProxyPass' and 'ProxyPassReverse' statements will do what you want.

Apache 2.2 mod_proxy documentation for more.

(yes this is a bit of a duplicate answer, but I'm trying to make things clearer and hoping nobody inadvertently starts an open proxy)

share|improve this answer

Your Answer

 
discard

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.