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.
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.
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
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.
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
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/
~
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:
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.
–
– Tom M., CTO
– Engine Y., Ruby on Rails Hosting
– Reliability, Ease of Use, Scalability
– (866) 518-YARD (9273)
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.
–
– 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.
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
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 ?
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.
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