OT:Mongrel and Apache

On the off chance someone might understand my dilemma I’m posting this:

Trying to set up Apache with a VirtualHost to pass requests to Mongrel
with
mod_proxy. Server is running an earlier version of RedHat 3.x maybe ?
and
Apache v.2.0 (right no mod_proxy_balancer)

I’m not a sys admin so kind of flying by the seat of my pants, though I
do
have the Mongrel deployment book.

The biggest problem right now is knowing where to put the VirtualHost.
My
rails app, while a sub folder under /var/www/html/railsapp
is configured like this:
/home/virtual/site8/fst/var/www/html/railsapp
I’ve seen a number of these virtual/site# locations. (i.e virtual/site1,
virtual/site2, virtual/site3…)

Yet I’ve looked in various httpd.conf files and find no configuration
for
these sites
Kind of confusing, and I know my question is just as confusing but if
anyone
has any insight I’d appreciate it.

TIA
Stuart

This configuration, without mod_proxy_balancer, means you’ll only be
able
to process one concurrent request at a time.

Performance is going to be severely limited.

On 11/13/06, Tom M. [email protected] wrote:

This configuration, without mod_proxy_balancer, means you’ll only be
able
to process one concurrent request at a time.

Performance is going to be severely limited.

Sounds like I should get an upgrade.

On Nov 13, 2006, at 10:05 AM, Dark A. wrote:

Kind of confusing, and I know my question is just as confusing but
if anyone has any insight I’d appreciate it.

Stuart Fellowes wrote:

On the off chance someone might understand my dilemma I’m posting this:

Trying to set up Apache with a VirtualHost to pass requests to Mongrel
with
mod_proxy. Server is running an earlier version of RedHat 3.x maybe ?
and
Apache v.2.0 (right no mod_proxy_balancer)

I’m not a sys admin so kind of flying by the seat of my pants, though I
do
have the Mongrel deployment book.

The biggest problem right now is knowing where to put the VirtualHost.
My
rails app, while a sub folder under /var/www/html/railsapp
is configured like this:
/home/virtual/site8/fst/var/www/html/railsapp
I’ve seen a number of these virtual/site# locations. (i.e virtual/site1,
virtual/site2, virtual/site3…)

Yet I’ve looked in various httpd.conf files and find no configuration
for
these sites
Kind of confusing, and I know my question is just as confusing but if
anyone
has any insight I’d appreciate it.

TIA
Stuart

Hi Stuart,

The virtual hosts are probably being loaded via an include statement in
the httpd.conf, this allows you to easily manage all of the sites
individually and in an easy to manage structure so you are not directly
editing the httpd.conf. We run the same way and it really hasn’t been a
problem for low traffic sites.

Each site has it’s own conf file, for example site.conf

<VirtualHost 223.555.555.555>
ServerName my.sites.url
DocumentRoot /home/sites/apache/my_site/www
ProxyPass /some/mongrel/process
php_value upload_max_filesize 32M
php_value post_max_size 32M
php_value memory_limit 32M
php_value max_input_time 180
php_value max_execution_time 180
Alias /pic/ /home/sites/some/directory
Alias /javascript/ /home/sites/some/javascript/
Alias /js/ /home/sites/some/javascript/
php_value include_path
‘/home/sites/somesite/lib:/home/sites/otherloc/lib:.’
php_flag register_globals off
php_flag allow_call_time_pass_reference on
php_flag magic_quotes_gpc off
php_value error_reporting 2047
<Files “download.php”>
AcceptPathInfo On


~

and in your httpd.conf have a line like:

Include /home/sites/apache/*.conf

This will load every .conf file in /home/sites/apache and bingo, there
are your vhosts all tidy.

Hope this helps

On 11/13/06, s.ross [email protected] wrote:

Are you hosting this on your own box or a VPS? If you’re using shared
hosting, I’d find someone who will let you proxy to something like Pound.
A
slightly less efficient alternative is to have Apache proxy to Pound and
have Pound do the load balancing among the Mongrel cluster.

Own box through a host provider. Multiple sites on server.

Stuart

I don’t know how well the latter suggestion would work. Anyone else have
any

with
rails app, while a sub folder under /var/www/html/railsapp
has any insight I’d appreciate it.

Are you hosting this on your own box or a VPS? If you’re using shared
hosting, I’d find someone who will let you proxy to something like
Pound. A
slightly less efficient alternative is to have Apache proxy to Pound and
have Pound do the load balancing among the Mongrel cluster.

I don’t know how well the latter suggestion would work. Anyone else have
any
opinions?

–steve

Dark A. wrote:

have the Mongrel deployment book.
Kind of confusing, and I know my question is just as confusing but if
Dark ambient - Wikipedia


View this message in context:
http://www.nabble.com/-Rails--OT%3AMongrel-and-Apache-tf2624126.html#a7322701
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

On 11/13/06, Phil P. [email protected] wrote:

virtual/site2, virtual/site3…)

the httpd.conf, this allows you to easily manage all of the sites
php_value upload_max_filesize 32M
php_flag allow_call_time_pass_reference on
Include /home/sites/apache/*.conf

This will load every .conf file in /home/sites/apache and bingo, there
are your vhosts all tidy.

Hope this helps

Yep, I found them all. Thank you. I guess now the problem is the Apache
version.

Stuart

Posted via http://www.ruby-forum.com/.

This is from the Mongrel site for setting up the proxy:

<VirtualHost *:80>
ServerName myapp.com
ServerAlias www.myapp.com

ProxyPass / http://www.myapp.com:8000/
ProxyPassReverse / http://www.myapp.com:8000
ProxyPreserveHost on

The only thing here is I only want requests to be forward when the
subdomain is called.
So do I leave ServerName and ServerAlias alone ?
The subdomain would be data.myapp.com

Do I put that into Proxy Pass and Reverse ?

TIA
Stuart

On 11/13/06, Dark A. [email protected] wrote:

mod_proxy. Server is running an earlier version of RedHat 3.x maybe ?
rails app, while a sub folder under /var/www/html/railsapp
has any insight I’d appreciate it.

<VirtualHost 223.555.555.555>
Alias /js/ /home/sites/some/javascript/
~


Dark ambient - Wikipedia

Stuart Fellowes wrote:

This is from the Mongrel site for setting up the proxy:

<VirtualHost *:80>
ServerName myapp.com
ServerAlias www.myapp.com

ProxyPass / http://www.myapp.com:8000/
ProxyPassReverse / http://www.myapp.com:8000
ProxyPreserveHost on

The only thing here is I only want requests to be forward when the
subdomain is called.
So do I leave ServerName and ServerAlias alone ?
The subdomain would be data.myapp.com

Do I put that into Proxy Pass and Reverse ?

TIA
Stuart

Hey Stuart,

Yes, leave the hosts alone, you only want to proxypass and
proxypassreverse for the railsapp related stuff, so, for example, if you
were going to put the rails app at 应用宝官网-全网最新最热手机应用游戏下载 your lines would
look like this:

proxypass / http://localhost:8000 #the port that your mongrel is
running on
proxypassreverse / http://localhost:8000

should do the trick.

Phil

Sorry, disregard the /railsapp related stuff above, my mind was
elsewhere, but the proxypass directives should accomplish what you want.

On Nov 13, 2006, at 12:49 PM, s.ross wrote:

Proxying from Apache without load balancing somewhere in the mix
will give
you relatively poor performance. Tom M. commented on this.

…snip relevant and insightful information…

Even if you have to proxy Apache to Pound and have Pound listen on
port 8000,
you can then use Pound to do the load balancing among N Mongrels in
a Mongrel
cluster. That removes the dependency on a complete request turnaround.

Anyone? Please correct me if this is incorrect. This is,
essentially how my
sites are set up.

Spot on, and good idea to put a balancer after Apache and before
mongrel_cluster. Generally speaking, I like simpler -vs- more
complex, but
installing a new version of Apache may not quality as simpler in this
case. :slight_smile:


– Tom M., CTO
– Engine Y., Ruby on Rails Hosting
– Reliability, Ease of Use, Scalability
– (866) 518-YARD (9273)

On 11/13/06, Tom M. [email protected] wrote:

Even if you have to proxy Apache to Pound and have Pound listen on
mongrel_cluster. Generally speaking, I like simpler -vs- more
complex, but
installing a new version of Apache may not quality as simpler in this
case. :slight_smile:


– Tom M., CTO

No, but I’m not going to be the one doing it :).
Seriously, though I looked at Pound, not even sure if it would run on
this
server. Earlier version of Redhat,
and what else would surprise me.

Stuart

Proxying from Apache without load balancing somewhere in the mix will
give
you relatively poor performance. Tom M. commented on this. If
Apache
proxies to, say, port 8000 and mongrel is listening on 8000, each
request
will have to complete before the next one can be served. Contrast this
with
a more typical fcgi or Mongrel cluster setup where there are several
Rails
processes any of which can serve a page upon request.

This may not seem like a big deal, but put a little Ajax on your pages
and
you will be making numerous requests per second. One application
instance
will feel pokey. Even if you have to proxy Apache to Pound and have
Pound
listen on port 8000, you can then use Pound to do the load balancing
among N
Mongrels in a Mongrel cluster. That removes the dependency on a complete
request turnaround.

Anyone? Please correct me if this is incorrect. This is, essentially how
my
sites are set up.

Steve

Dark A. wrote:

have the Mongrel deployment book.
Kind of confusing, and I know my question is just as confusing but if
Dark ambient - Wikipedia


View this message in context:
http://www.nabble.com/-Rails--OT%3AMongrel-and-Apache-tf2624126.html#a7325409
Sent from the RubyOnRails Users mailing list archive at Nabble.com.

On 11/13/06, Dark A. [email protected] wrote:

…snip relevant and insightful information…

No, but I’m not going to be the one doing it :).
Seriously, though I looked at Pound, not even sure if it would run on this
server. Earlier version of Redhat,
and what else would surprise me.

Stuart

Also , probably a stupid question , but if I have the Rails app on a
subdomain do I even need to set up the proxy ?

Stuart

Hi Stuart:

Above posts are correct, you will want to create a Mongrel cluster, not
just one Mongrel server, or you just won’t be getting your
top-value-per-dollar. Of course you can’t do that without Apache 2.1 or
later so I would definitely recommend an Apache2 upgrade.

Setting up a Mongrel cluster is outlined at the Mongrel home website.
Once you’ve done that, here is a sample configuration for Apache2 to
proxy a subdomain over to that cluster, assuming a local machine Mongrel
cluster on ports 8000-8002.

<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

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs/test
ServerName test.server.com
ServerAlias test.server.com
ErrorLog logs/test.server.com-error_log
CustomLog logs/test.server.com-access_log common
ProxyRequests Off
ProxyPass / balancer://mongrel_cluster
ProxyPassReverse / /balancer://mongrel_cluster

If you wanted to put your application in a folder off the root instead
of in a subdomain, then you would just put the Proxy lines into the
default VirtualHost definition in your Apache2 configuration, edited for
the folder you’re working with. For instance, if you had it in a folder
called “test”, then you would have these directives in your default
VirtualHost section:

ProxyRequests Off
ProxyPass /test balancer://mongrel_cluster
ProxyPassReverse /test /balancer://mongrel_cluster

In this case you will also need the reverse_proxy_fix plugin from:
http://www.napcsweb.com/blog/2006/05/10/reverse-proxy-fix-plugin/.

c.

Cayce B. wrote:

ProxyPassReverse / /balancer://mongrel_cluster

woops - typo - remove the second “/” in that line in both places -
should be:

 ProxyPassReverse / balancer://mongrel_cluster

c.