logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Virtual Host & Proxy configuration
Author
visioner



Joined: 13 Apr 2007
Posts: 2

PostPosted: Fri 13 Apr '07 7:57    Post subject: Virtual Host & Proxy configuration Reply with quote

Dear Users,

Ik have a small configuration question.
Let me describe the problem.

I have 2 domains, t1.cronos.be & t2.cronos.be
that point to the same ip: 130.0.0.1 that runs
apache 2.2 with the following proxy
configuration:

Code:
NameVirtualHost 130.0.0.1:80
 
<VirtualHost 130.0.0.1:80>
ServerName t1.cronos.be
ProxyPass / http://127.0.0.1:8881/
ProxyPassReverse / http://127.0.0.1:8881/
</VirtualHost>
 
<VirtualHost 130.0.0.1:80>
ServerName t2.cronos.be
ProxyPass / http://127.0.0.1:8882/
ProxyPassReverse / http://127.0.0.1:8882/
</VirtualHost>


On port 8881 & 8882 are 2 tomcat-server
running with an root-application. All of this seems
to be working. But now I would like to deploy the
applications under a different context, namely
t1 & t2, so I would like to come to a configuration
like this.

Code:
<VirtualHost 130.0.0.1:80>
ServerName t1.cronos.be
ProxyPass / http://127.0.0.1:8881/t1
ProxyPassReverse / http://127.0.0.1:8881/t1
</VirtualHost>


But this obviously doesn't work. I suppose I would
have to use something like a rewriterule, but I'm very
new at this and all my attempts have failed.

Can any of you help.

Thanks in advance,

Bart Laeremans
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Fri 13 Apr '07 9:44    Post subject: Reply with quote

may be you can use mod_proxy ajp

see
http://www.apachelounge.com/viewtopic.php?p=2636

If there isn't an answer for you please ask again.
Back to top
visioner



Joined: 13 Apr 2007
Posts: 2

PostPosted: Fri 13 Apr '07 11:10    Post subject: Thanks for the reply Reply with quote

Thanks for the reply, but using ajp won't solve my
problem. Because it still requires the path to be the
same. The problem is although mapping
/ to /context works the hyperlinks in the pages afterwards
already contain the context and get mapped to
/contextcontext, which doesn't exist.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Fri 13 Apr '07 16:18    Post subject: Reply with quote

You could rewrite the content with mod_proxy_html

Code:

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadFile   /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so

ProxyRequests off
ProxyPass /app1/ http://internal1.example.com/
ProxyPass /app2/ http://internal2.example.com/
ProxyHTMLURLMap http://internal1.example.com /app1
ProxyHTMLURLMap http://internal2.example.com /app2

<Location /app1/>
   ProxyPassReverse /
   SetOutputFilter    proxy-html
   ProxyHTMLURLMap    /   /app1/
   ProxyHTMLURLMap    /app1   /app1
   RequestHeader     unset   Accept-Encoding
</Location>

<Location /app2/>
   ProxyPassReverse /
   SetOutputFilter   proxy-html
   ProxyHTMLURLMap   /   /app2/
   ProxyHTMLURLMap   /app2   /app2
   RequestHeader   unset   Accept-Encoding
</Location>
Back to top
puertoblack2003



Joined: 31 Jul 2009
Posts: 121
Location: U.S

PostPosted: Sun 25 Oct '09 23:06    Post subject: Reply with quote

James Blond wrote:
You could rewrite the content with mod_proxy_html

Code:

LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule headers_module    modules/mod_headers.so
LoadFile   /usr/lib/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so

ProxyRequests off
ProxyPass /app1/ http://internal1.example.com/
ProxyPass /app2/ http://internal2.example.com/
ProxyHTMLURLMap http://internal1.example.com /app1
ProxyHTMLURLMap http://internal2.example.com /app2

<Location /app1/>
   ProxyPassReverse /
   SetOutputFilter    proxy-html
   ProxyHTMLURLMap    /   /app1/
   ProxyHTMLURLMap    /app1   /app1
   RequestHeader     unset   Accept-Encoding
</Location>

<Location /app2/>
   ProxyPassReverse /
   SetOutputFilter   proxy-html
   ProxyHTMLURLMap   /   /app2/
   ProxyHTMLURLMap   /app2   /app2
   RequestHeader   unset   Accept-Encoding
</Location>


for this config under app1 and app2 is that consider the directory to were the files is housed?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7355
Location: Germany, Next to Hamburg

PostPosted: Mon 26 Oct '09 15:53    Post subject: Reply with quote

@puertoblack2003

Than it will be http://reverseproxy/app1/
Back to top
puertoblack2003



Joined: 31 Jul 2009
Posts: 121
Location: U.S

PostPosted: Tue 27 Oct '09 23:07    Post subject: Reply with quote

James Blond wrote:
@puertoblack2003

Than it will be http://reverseproxy/app1/


that's were I'm trying to understand.If my site let's say the root is "forum" and my domain will call for www.mydomain.com not www.mydomain.com/forum

so with this setting even though my domain root folder is "forum" and not using the forward slash /forum I still have to add that to the proxy config?

this is a test config i dint setup yet


Quote:
ProxyRequests off
ProxyPass /forum/ http://mydomain.net/
ProxyPass /forums/ http://forum.mydomain.com/
ProxyHTMLURLMap http://mydomain.net/forum
ProxyHTMLURLMap http://forum.mydomain.com/forums

<Location /forum/>
ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap / /forum/
ProxyHTMLURLMap /forum /forum
RequestHeader unset Accept-Encoding
</Location>

<Location /forums/>
ProxyPassReverse /
SetOutputFilter proxy-html
ProxyHTMLURLMap / /forums/
ProxyHTMLURLMap /forums /forums
RequestHeader unset Accept-Encoding
</Location>


now in my vhost is


Quote:
<VirtualHost *:80>

ServerAdmin myemailaccount@gmail.com
DocumentRoot "F:/pathtorootdomain/forum"
ServerName mydomain.com
ServerAlias www.mydomain.com
ErrorLog "logs/mydomain.net-error.log"
CustomLog "logs/mydomain.net-access.log" common

<Directory "F:/pathto root/forum">
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>

<Directory "F:/pathtoroot/forum/includes">
AllowOverride FileInfo Options Limit
<Files config.php>
order deny,allow
deny from all
</Files>
</Directory>

<LocationMatch ^/c/css/rd+/.+.css>
NeverExpire on
</LocationMatch>

</VirtualHost>
Back to top


Reply to topic   Topic: Virtual Host & Proxy configuration View previous topic :: View next topic
Post new topic   Forum Index -> Apache