{"id":384,"date":"2013-06-07T08:51:20","date_gmt":"2013-06-07T08:51:20","guid":{"rendered":"http:\/\/nicholshayes.co.uk\/blog\/?p=384"},"modified":"2013-10-31T15:52:11","modified_gmt":"2013-10-31T15:52:11","slug":"passenger-rackbaseuri-and-the-public-folder","status":"publish","type":"post","link":"http:\/\/nicholshayes.co.uk\/blog\/?p=384","title":{"rendered":"Passenger, RackBaseURI and the public folder"},"content":{"rendered":"<p>I&#8217;ve been installing passenger on my development PC so that I can debug an issue that is only apparent in production (it&#8217;s due to the app being hosted in a sub-uri). I don&#8217;t tend to use passenger much myself, as in most of the environments I&#8217;ve worked in there has either already been a server set up, or there is a sys-admin who needs to manage the server set up. However, doing this myself has been really useful and I&#8217;ve learnt a lot from doing it. (Another &#8220;why haven&#8217;t I worked out all this before&#8221; moment).<\/p>\n<p>The main problem I had was that I kept having to point RackBaseURI at the public folder in my app, which left &#8216;\/public&#8217; in the app&#8217;s url. So instead of &#8216;\/mysite&#8217;, I was getting &#8216;\/mysite\/public&#8217;. <\/p>\n<p>As is so often the case once you know the solution, the answer was very simple. I had overlooked the significance of a single line in the <a href=\"http:\/\/www.modrails.com\/documentation\/Users%20guide%20Apache.html#deploying_rack_to_sub_uri\">passenger documentation<\/a>:<\/p>\n<div class=\"codecolorer-container text default\" style=\"overflow:auto;white-space:nowrap;\"><div class=\"text codecolorer\">ln -s \/webapps\/rackapp\/public \/websites\/phusion\/rack<\/div><\/div>\n<p>That sets up a symlink to the public folder of your app. It also means that RackBaseURI is not pointing at the real folder where the code is, but to a symlink in your web root. Now I realise the significance of this line in the docs, it is obvious to me that this a better way to arrange things. <\/p>\n<p>With the the symlink in place everything started working properly.<\/p>\n<p>One thing that playing with this has taught me is that the passenger documentation is very good. A couple of times google searches led me to outdated methods that no longer worked with the version of passenger I was using. Each time the solution was found within the passenger docs. <\/p>\n<p>The problem is that the <a href=\"http:\/\/www.modrails.com\/documentation\/Users%20guide%20Apache.html\">apache guide<\/a> is a very long document. However, my experience was that it was much more fruitful to search the passenger documention page for keywords, than to google for the solution. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been installing passenger on my development PC so that I can debug an issue that is only apparent in production (it&#8217;s due to the app being hosted in a sub-uri). I don&#8217;t tend to use passenger much myself, as &hellip; <a href=\"http:\/\/nicholshayes.co.uk\/blog\/?p=384\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384"}],"collection":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=384"}],"version-history":[{"count":4,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions"}],"predecessor-version":[{"id":435,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/384\/revisions\/435"}],"wp:attachment":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=384"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}