I have passenger-stand-alone (v3.0.7) running a rails app and am starting it this way:
$ passenger start -a 127.0.0.1 -p 3003 -d
I have a directory inside the public directory which I would like when accessed to return the content of index.html if such a
file exists.
This file exists: public/content/index.html
However accessing this url: http://3003/content the server returns a Rails Routing Error
No route matches "/content" with {:method=>:get}
Is there any additional configuration options when running passenger-standalone that would enable this behavior?
I was following the setup described here:
http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/
And had the problem that I am not able to serve index.html content from path ending in a dir reference.
I described the simplified problem in the earlier post.
Everything is working with the apache vhost using a reverse proxy to the passenger stand-alone instance running in 1.8.7
*except* for the delivery of index.html
I tried making this change in passenger to tell nginx to resolve a directory access to index.html (if one exists):
index 93cbaad..0b27f92 100644
--- a/lib/phusion_passenger/templates/standalone/config.erb
+++ b/lib/phusion_passenger/templates/standalone/config.erb
@@ -82,6 +82,7 @@ http {
listen <%= nginx_listen_address(app) %>;
server_name <%= app[:server_names].join(' ') %>;
root '<%= app[:root] %>/public';
+ index index.html;
passenger_enabled on;
rails_env <%= app[:env] %>;
passenger_spawn_method <%= app[:spawn_method] %>;
After starting passenger in stand-alone mode I see that change in the config file in the config file located here:
/tmp/passenger-standalone.<nnnnn>/config
Loading the full url (a SproutCore app) works:
http://127.0.0.1:3003/sc-runtime/index.html
While loading the partial url fails with a routing error from rails:
http://127.0.0.1:3003/sc-runtime/
=> No route matches "/sc-runtime/" with {:method=>:get}:
https://github.com/FooBarWidget/passenger/blob/master/ext/nginx/ContentHandler.c#L147
This code appears to only check for the presence of index.html in the root of the public dir.
The similar code in the apache2 extension appears to check any file where the fileType == FT_DIRECTORY and if the url ends with
'/' athen checks to see if path + index.html exists.
https://github.com/FooBarWidget/passenger/blob/master/ext/apache2/Hooks.cpp#L461
https://github.com/FooBarWidget/passenger/pull/15
I'm not much of a C programmer so only did the bare minimum to get this working.
I generated the gem, installed it into 1.8.7, deleted the ~/.passenger dir (where the stand-alone build artifacts are located)
and re-created and started the stand-alone server:
$ passenger start -a 127.0.0.1 -p 3003
Now accessing this url renders the SproutCore application
http://127.0.0.1:3003/sc-runtime/
The rest of the rails app also works.
Hongli,
Are you interested in this pull request.
I have team members that I'd like to use this feature and it would be nice if they didn't have to clone the repo, and buildand install the gem manually.