The documentation is a little unclear. The first thing to keep in mind is that you should not have both of the server blocks that are listed. Just add the extra lines:
passenger_enabled on;
passenger_base_uri /rails;
Here are my parenthetical comments for doc code:
(port number, nothing new here)
server {
listen 80;
server_name www.phusion.nl;
(server name. Nothing new here either)
root /websites/phusion;
(this is describing the root of the main site, not the app on the suburi)
passenger_enabled on;
(self-explanatory)
passenger_base_uri /rails;
}
(The suburi that will be tagged on at the end of the path)
And for the symlink
ln -s /webapps/mycook/public /websites/phusion/rails
This links the public directory of the webapp that you are deploying on the suburi to appear in the folder of the main site.
Other things to keep in mind:
If you're using a rails app from version 2.2.2 on, you will have to make an additional adjustment. This blog recommends opening up the ActionController and ActionView base classes for an "automatic fix" that doesn't "hardcode" the uri. This is clever, but for now I don't need that level of dynamism. Adding this line works fine for me:
config.action_controller.relative_url_root = '/myapp'
Besides this, one thing to look out for is any places in your application where you've hardcoded routes in params for url_for(link_to, etc) methods. These will not add the requisite '/myapp', causing potential breakage.
I'm sure you didn't do that though, because you know better. However, maybe you from 6 months ago didn't...
No comments:
Post a Comment