Fame, glory, and a lot of appreciation would shower upon anyone who can
indicate how to use mongrel with apache2, to get multiple public apps on
one host, without DNS or IP tweaking, etc.
To be concrete, let's say we're trying to expose the following sites
using Rails, Mongrel, and Apache2. It should be assumed that the person
doing the work has root access (is able to edit httpd.conf, to restart
the web server, etc.), but does *not* have the ability to alter IP or
DNS information. For reasons whose details are irrelevant, two other
requirements are that the site has to be exposed to the outside world
(127.0.0.1 is not sufficient) and that commercial hosting is not a
solution.
Apology: I know that I am asking a question that has been asked before.
However, I've been unable to uncover a proposed solution that was
reported by the questioner to work. For reference, some threads on the
topic include:
Is there a reason why the solution I posted in my message in the second thread above does not work for you? If you are having problems with images in a CSS stylesheet you'll need something like this:
Is there a reason why the solution I posted in my message in the second
thread above does not work for you? If you are having problems with
images in a CSS stylesheet you'll need something like this:
The problem is that I don't get images. (Actually, at the moment, I don't even get a site, unless I use 127.0.0.1, but I've taken several steps backward lately, so if I can just get images I'll be happier!)
I start mongrel with the command
<pre>
mongrel_rails start -d -p 8010 -a 127.0.0.1 -e development --prefix /LSCbc
</pre>
and my http.conf contains as below.
<pre>
# DEK 20070429 start
Alias /LSCbc "/Users/kelley/Sites/LSCbc/public"
<Directory "/Users/kelley/Sites/LSCbc/public">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
ProxyPass /LSCbc/images !
ProxyPass /LSCbc/stylesheets !
ProxyPass /LSCbc/javascripts !
ProxyPass /LSCbc/ http://127.0.0.1:8010/LSCbc#ProxyPass /LSCbc/images http://127.0.0.1:8010/LSCbc/images
ProxyPass /LSCbc http://127.0.0.1:8010/LSCbc
ProxyPassReverse /LSCbc/ http://127.0.0.1:8010/LSCbc
# DEK 20070429 end
</pre>
and the result is that images (used by my stylesheet) do not show up. They are called as follows, in my public/stylesheets/style.css file:
<pre>
background: url('/images/headerlogo.png') bottom left no-repeat transparent;
</pre>
Well you have a problem cause you have a generic "/images" directory reference and multiple apps that can point to it. You have to resolve the ambiguity somehow.
One way is as described in my link above which you almost have correct but not quite:
and so I'm wondering whether I should use the former or the latter. (My impression was that the former is better for speed.)
Yes the former is better for speed since you are having Apache serve those static files instead of Mongrel but that only works if you have an Alias or other path mapping setup to that directory (which you do). I.e. the "!" means to not proxy URLs that match the specified path.
I'm transferring now from my laptop to another machine that's turned on all the time, but now I have a new difficulty: I can access all the pages through 127.0.0.1, but not through the proxy. Through the proxy, I can access only the page pointed at in my config/routes.rb file. Other pages give an error
<pre>
no route found to match "books/list" with {:method=>:get}
</pre>
(FYI, this is a site for a book club, hence the name.)
My httpd.conf lines are:
<pre>
# DEK 20070430 start
Alias /LSCbc "/Users/kelley/Sites/LSCbc/public"
<Directory "/Users/kelley/Sites/LSCbc/public">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
ProxyPass /LSCbc/public/images !
ProxyPass /LSCbc/public/stylesheets !
ProxyPass /LSCbc/public/javascripts !
ProxyPass /LSCbc/ http://127.0.0.1:8010/LSCbc
ProxyPass /LSCbc http://127.0.0.1:8010/LSCbc
ProxyPassReverse /LSCbc/ http://127.0.0.1:8010/LSCbc
# DEK 20070430 end
</pre>
PS. I realize this is a bit of a different issue, but it's connected by the use of ProxyPass, I guess, so that's my excuse
How are you launching Mongrel and what does the "books/list" URL look like in the source HTML?