2

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?

grigoryvp
  • 3,655
  • 11
  • 39
  • 59

4 Answers4

4

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>
alvosu
  • 8,437
  • 25
  • 22
2

I think you are almost there try adding

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

to your VirtualHost definition

user9517
  • 115,471
  • 20
  • 215
  • 297
2

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

Mark Porter
  • 1,011
  • 1
  • 6
  • 12
0

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)

Koos van den Hout
  • 1,096
  • 6
  • 10