[Mongrel] Apache/Mongrel Question

Marc Love Marc.Love at herbank.com
Tue Oct 24 12:59:05 EDT 2006


Thanks Anatol,

I'm implemented your suggested fix, but it doesn't appear to solve the problem.  Is there something wrong with my apache configuration?:

# vi /etc/apache2/httpd.conf.local

<VirtualHost *:80>
        # Fix for Apache bug 39499
        SetEnv force-proxy-request-1.0 1
        SetEnv proxy-nokeepalive 1

        ServerName herb
        DocumentRoot /srv/www/apps/intranet/current/public

        <Directory "/srv/www/apps/intranet/current/public">
                Options FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>

        RewriteEngine On
        # If there is a maintenance.html file in the public
        # directory, all requests will get rerouted to this file.
        RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
        RewriteCond %{SCRIPT_FILENAME} !maintenance.html
        RewriteRule ^.*$ /system/maintenance.html [L]
        # Rewrite index to check for static index.html
        RewriteRule ^/$ /index.html [QSA]
        # Rewrite to check for Rails cached pages with .html extensions
        RewriteRule ^([^.]+)$ $1.html [QSA]
        # All dynamic requests get sent directly to the mongrel cluster
        RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]

        # This is required to convince Rails (via mod_proxy_balancer) that
        # we're actually using HTTPS.
        # RequestHeader set X_FORWARDED_PROTO 'https'

        # Deflate when possible
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE text/plain
        AddOutputFilterByType DEFLATE text/xml
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE text/javascript
        AddOutputFilterByType DEFLATE application/x-javascript
        AddOutputFilterByType DEFLATE application/xml
        AddOutputFilterByType DEFLATE application/xhtml+xml
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

        ErrorLog /srv/logs/apache_errors.log
</VirtualHost>

# Configure mongrel_cluster
<Proxy balancer://mongrel_cluster>
        BalancerMember http://127.0.0.1:8000 
        BalancerMember http://127.0.0.1:8001 
        BalancerMember http://127.0.0.1:8002 
</Proxy>

Listen 8080
<VirtualHost *:8080>
        # Map the subversion server
        <Location /svn>
                DAV svn
                SVNPath /svn
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from [removed]
                Allow from [removed]
        </Location>
        <Location /server-status>
                SetHandler server-status
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from [removed]
                Allow from [removed]
        </Location>
        # Map the mod_proxy_balancer manager for http access
        <Location /balancer-manager>
                SetHandler balancer-manager
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from [removed]
                Allow from [removed]
        </Location>
</VirtualHost>
                                                                                                                                            
>>> "Anatol Pomozov" <anatol.pomozov at gmail.com> 10/20/2006 10:34 PM >>>
Hi Mark.

See here http://blog.pomozov.info/posts/apache-mongrel-and-proxy-error.htmlI 
think this is your case.

On 10/21/06, Marc Love <Marc.Love at herbank.com> wrote:
>
> I don't understand why Apache would find something when I'm accessing it
> on the localhost but wouldn't find something when I'm accessing it from a
> remote computer.
>
> I'm using mod_proxy_balancer, so Apache is passing off the requests to the
> mongrel_cluster, right? Regardless of where the request is coming from.  So
> why would I get a Rails error message on the localhost, but an Apache error
> on a remote host?
>
> >>> "Joey Geiger" <jgeiger at gmail.com> 10/20/2006 5:18 PM >>>
> You're getting this error because apache isn't finding anything on the
> other end of the proxy.
>
> For example, if you're doing:
>
> ProxyPass / 127.0.0.1:3000/
>
> 127.0.0.1:3000 isn't responding, so apache can't pass the request off.
>
> On 10/20/06, Marc Love <Marc.Love at herbank.com> wrote:
> > I'm setting up a new server in anticipation of switching from
> lighttpd+fcgi.  My application isn't completely imported yet, so I don't
> expect it to work.  For instance right now when pulling up my app from
> localhost I get my Ruby/Rails MySQL error message.  But when I pull it up
> from a remote computer I get a proxy error from Apache:
> >
> > ======================
> > Proxy Error
> >
> > The proxy server received an invalid response from an upstream server.
> > The proxy server could not handle the request GET /.
> >
> > Reason: Error reading from remote server
> >
> > Additionally, a 502 Bad Gateway error was encountered while trying to
> use an ErrorDocument to handle the request.
> > ======================
> >
> > Is there a reason why I get this instead of the Ruby/Rails error?
> >
> > -Marc
> >
> >
> >
> > ==================DISCLAIMER================================
> > This email may contain confidential and privileged material for the sole
> use of the intended recipient.
> > Any review or distribution by others is strictly prohibited. If you are
> not the intended recipient, please contact the sender and delete all copies
> of it from your system.
> > The sender accepts no responsibility for viruses and it is your
> responsibility to scan attachments (if any).
> > No contracts may be concluded on behalf of the sender by means of email
> communications unless expressly stated to the contrary.
> > ==================DISCLAIMER================================
> > _______________________________________________
> > Mongrel-users mailing list
> > Mongrel-users at rubyforge.org 
> > http://rubyforge.org/mailman/listinfo/mongrel-users 
> >
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org 
> http://rubyforge.org/mailman/listinfo/mongrel-users 
>
>
>
> ==================DISCLAIMER================================
> This email may contain confidential and privileged material for the sole
> use of the intended recipient.
> Any review or distribution by others is strictly prohibited. If you are
> not the intended recipient, please contact the sender and delete all copies
> of it from your system.
> The sender accepts no responsibility for viruses and it is your
> responsibility to scan attachments (if any).
> No contracts may be concluded on behalf of the sender by means of email
> communications unless expressly stated to the contrary.
> ==================DISCLAIMER================================
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org 
> http://rubyforge.org/mailman/listinfo/mongrel-users 
>



-- 
anatol (http://feeds.feedburner.com/apomozov-eng)


==================DISCLAIMER================================
This email may contain confidential and privileged material for the sole use of the intended recipient.
Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies of it from your system.
The sender accepts no responsibility for viruses and it is your responsibility to scan attachments (if any).
No contracts may be concluded on behalf of the sender by means of email communications unless expressly stated to the contrary.
==================DISCLAIMER================================


More information about the Mongrel-users mailing list