Multiple rails apps on different ports w/ Apache/Passenger

Rob Schultz rschultz7 at
Wed Sep 9 04:48:57 MSD 2009

On Sep 8, 2009, at 7:26 PM, Paul Hamann wrote:

> I'm putting three apps onto a linux box sitting in my bedroom.  I'm
> putting them online through dynamic DNS [dyndns].  I would prefer to
> only open one port: 80.  I could simply open more ports and tack :8080
> and such onto the end of the url.  That's ugly.
The suburl document that i linked to is Passenger's official support  
for multiple rails application running on 1 apache/nginx instance. The  
apache specific portion can be found under the apache documentation.  
Then you could just have NginX or apache listening on port 80 and  
handling all the requests without having to proxy to multiple  
instances of apache.

> Yes, I could use Apache mod_rewrite.  I ** don't like ** apache  
> rewrite.
> Yes, I'm sure that I could do this with Nginx/passenger alone.  The  
> one
> time I tried Nginx/passenger together, it didn't benchmark well.  That
> may have been my own ignorance of Nginx. And truly, performance may  
> not
> be much of an issue.
I am pretty sure you shouldn't see any slower performance with NginX +  
Passenger then having NginX / Apache + passenger. I mean you taking 1  
less software out of the stack. If you having performance issues then  
might wish to post your config or it could be a bug or issue with the  
passenger NginX module.

> May be I'm over-thinking it here. It seems to me that this similar  
> setup
> would work well in this case.  It's just that I can't get the Nginx
> configuration file right.  From Nginx's perspective, it shouldn't care
> that it's passing rails to passenger. Sadly, I'm also ignorant of
> Mongrel.  I think that's why I'm struggling to make this work from  
> that
> example.
I think for the setup you would be needing a combination of
location /app1 {
	alias /path/to/app1/public;
	try_files $uri @apache;

location /app2 {
	alias /path/to/app2/public;
	try_files $uri @apache;

location @apache {
	proxy_pass http://localhost:8080;

This config probably won't work outta the box. I wrote it pure outta  
memory and that is shoddy at best!. But i think it might give you a  
general idea. Also not sure if root or alias would work best here.

> Thanks for the help.
> --Paul
> -- 
> Posted via

More information about the nginx mailing list