hey all, I have an app working great with apache2 and mongrel_cluster. However, I''m trying to run another application and now when I go to app1.comit falls to app2.com and the opposite. That''s probably because I messed up somewhere with the cluster. this is the content of my conf.d/app1.proxy_cluster.conf: <Proxy balancer://mongrel_cluster> BalancerMember http://app1.com:8000 BalancerMember http://app1.com:8001 BalancerMember http://app1.com:8002 </Proxy> and this is my conf.d/app2.proxy_cluster.conf: <Proxy balancer://mongrel_cluster> BalancerMember http://app2.com:8003 BalancerMember http://app2.com:8004 </Proxy> Maybe I need to change the name of my mongrel_cluster but I''m not sure how to do this :/ this is my sites-enabled/app1.conf: NameVirtualHost app1.com:80 <VirtualHost 88.191.38.108:80> ServerName app1.com ServerAlias www.app1.com DocumentRoot /home/patcito/testapp/public/ Include /etc/apache2/conf.d/testapp.common </VirtualHost> this is my conf.d/app1.common: <Directory "/home/patcito/testapp/public/"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> RewriteEngine On # Make sure people go to www.myapp.com, not myapp.com RewriteCond %{HTTP_HOST} ^app1.com$ [NC] RewriteRule ^(.*)$ http://www.app1.com$1 [R=301,L] # Check for maintenance file and redirect all requests RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /system/maintenance.html [L] # Rewrite index to check for static RewriteRule ^/$ /index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ $1.html [QSA] # Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! #continue with other static files that should be served by apache Alias /images /home/patcito/testapp/public/images Alias /stylesheets /home/patcito/testapp/public/stylesheets Alias /javascripts /home/patcito/testapp/public/javascripts those two files for app2 are similar. Any idea what''s wrong? thanx in advance Pat -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20061216/e6724e3e/attachment-0001.html
You must have Unique names for your balancer clusters. Right now, they are both named balancer://mongrel_cluster Try balancer://app1_cluster and balancer://app2_cluster You also probably need to include specific rewrite rules inside each app''s VirtualHost directive, or things will probably continue to not work right. Hope that helps! =Will Patrick Aljord wrote:> hey all, > I have an app working great with apache2 and mongrel_cluster. > However, I''m trying to run another application and now when I go to > app1.com <http://app1.com> it falls to app2.com <http://app2.com> and > the opposite. That''s probably because I messed up somewhere with the > cluster. > this is the content of my conf.d/app1.proxy_cluster.conf: > <Proxy balancer://mongrel_cluster> > BalancerMember http://app1.com:8000 > BalancerMember http://app1.com:8001 > BalancerMember http://app1.com:8002 > </Proxy> > > > and this is my conf.d/app2.proxy_cluster.conf: > <Proxy balancer://mongrel_cluster> > BalancerMember http://app2.com:8003 > BalancerMember http://app2.com:8004 > </Proxy> > > > Maybe I need to change the name of my mongrel_cluster but I''m not sure > how to do this :/ > this is my sites-enabled/app1.conf: > NameVirtualHost app1.com:80 <http://app1.com:80> > > <VirtualHost 88.191.38.108:80 <http://88.191.38.108:80>> > ServerName app1.com <http://app1.com> > ServerAlias www.app1.com <http://www.app1.com> > DocumentRoot /home/patcito/testapp/public/ > Include /etc/apache2/conf.d/testapp.common > </VirtualHost> > > this is my conf.d/app1.common: > <Directory "/home/patcito/testapp/public/"> > Options FollowSymLinks > AllowOverride None > Order allow,deny > Allow from all > </Directory> > > RewriteEngine On > > # Make sure people go to www.myapp.com <http://www.myapp.com>, not > myapp.com <http://myapp.com> > RewriteCond %{HTTP_HOST} ^app1.com$ [NC] > RewriteRule ^(.*)$ http://www.app1.com$1 [R=301,L] > > # Check for maintenance file and redirect all requests > RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f > RewriteCond %{SCRIPT_FILENAME} !maintenance.html > RewriteRule ^.*$ /system/maintenance.html [L] > > # Rewrite index to check for static > RewriteRule ^/$ /index.html [QSA] > > # Rewrite to check for Rails cached page > RewriteRule ^([^.]+)$ $1.html [QSA] > > # Redirect all non-static requests to cluster > RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f > RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L] > > # Deflate > AddOutputFilterByType DEFLATE text/html text/plain text/xml > application/xml application/xhtml+xml text/javascript text/css > BrowserMatch ^Mozilla/4 gzip-only-text/html > BrowserMatch ^Mozilla/4.0[678] no-gzip > BrowserMatch \bMSIE !no-gzip !gzip-only-text/html > > ProxyPass /images ! > ProxyPass /stylesheets ! > ProxyPass /javascripts ! > > #continue with other static files that should be served by apache > > Alias /images /home/patcito/testapp/public/images > Alias /stylesheets /home/patcito/testapp/public/stylesheets > Alias /javascripts /home/patcito/testapp/public/javascripts > > those two files for app2 are similar. Any idea what''s wrong? > thanx in advance > > Pat > > > ------------------------------------------------------------------------ > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
ok thanx a lot. I still have an issue though with my alias. see, in my app1.com I have this: ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! Alias /images /home/patcito/railsprojects/app1/public/images Alias /stylesheets /home/patcito/railsprojects/app1/public/stylesheets Alias /javascripts /home/patcito/railsprojects/app1/public/javascript and in my app2.common I have that: ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! Alias /images /home/patcito/railsprojects/app2/public/images Alias /stylesheets /home/patcito/railsprojects/app2/public/stylesheets Alias /javascripts /home/patcito/railsprojects/app2/public/javascript now when I reload apache I get: The Alias directive in /etc/apache2/conf.d/app1.common at line 56 will probably never match because it overlaps an earlier Alias. and css don''t get displayed in my app1.com Any idea how I can fix that? thanx in advance Pat
I think you need to put those directives into the virtual host sections. You get the error that they will overwrite each other because they do. On 12/18/06, Patrick Aljord <patcito at gmail.com> wrote:> ok thanx a lot. I still have an issue though with my alias. > see, in my app1.com I have this: > > ProxyPass /images ! > ProxyPass /stylesheets ! > ProxyPass /javascripts ! > > Alias /images /home/patcito/railsprojects/app1/public/images > Alias /stylesheets /home/patcito/railsprojects/app1/public/stylesheets > Alias /javascripts /home/patcito/railsprojects/app1/public/javascript > > and in my app2.common I have that: > ProxyPass /images ! > ProxyPass /stylesheets ! > ProxyPass /javascripts ! > > Alias /images /home/patcito/railsprojects/app2/public/images > Alias /stylesheets /home/patcito/railsprojects/app2/public/stylesheets > Alias /javascripts /home/patcito/railsprojects/app2/public/javascript > > now when I reload apache I get: > The Alias directive in /etc/apache2/conf.d/app1.common at line 56 will > probably never match because it overlaps an earlier Alias. and css > don''t get displayed in my app1.com > > Any idea how I can fix that? > > thanx in advance > > Pat > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >
On 12/18/06, Joey Geiger <jgeiger at gmail.com> wrote:> I think you need to put those directives into the virtual host sections. > > You get the error that they will overwrite each other because they do.you mean both the ProxyPass and the Alias or just the Alias? thanx
Both. Think of each VirtualHost directive as its own server (because, for all intents and purposes, it is). If you don''t set up a Proxies and Aliases for each server, then they only apply to the default server. Patrick Aljord wrote:> On 12/18/06, Joey Geiger <jgeiger at gmail.com> wrote: >> I think you need to put those directives into the virtual host sections. >> >> You get the error that they will overwrite each other because they do. > > you mean both the ProxyPass and the Alias or just the Alias? > > thanx > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users