Author |
|
visioner
Joined: 13 Apr 2007 Posts: 2
|
Posted: Fri 13 Apr '07 7:57 Post subject: Virtual Host & Proxy configuration |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
|
Back to top |
|
visioner
Joined: 13 Apr 2007 Posts: 2
|
Posted: Fri 13 Apr '07 11:10 Post subject: Thanks for the reply |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
Posted: Fri 13 Apr '07 16:18 Post subject: |
|
|
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
|
Posted: Sun 25 Oct '09 23:06 Post subject: |
|
|
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: 7373 Location: Germany, Next to Hamburg
|
|
Back to top |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Tue 27 Oct '09 23:07 Post subject: |
|
|
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 |
|