librelist archives

« back to archive

nestacms in a subdirectory

nestacms in a subdirectory

From:
aaron addleman
Date:
2013-06-27 @ 16:46
Hello Anyone,

I have a Nesta site installed with Passenger in a subdirectory called /sg/.
I have the entier site working, but I have been doing some ugly hacks to
get the links in my theme to find the stylesheets. Currently I have been
using:

%link{:href => "#{url('/stylesheets/fixes.css')}"

But maybe there is an easier way to do this by telling Sinatra where the
application is? Or is it Passenger that is confused? or Nesta? Or me?

Thanks in advance,
Aaron

Re: [nesta] nestacms in a subdirectory

From:
Graham Ashton
Date:
2013-07-01 @ 06:32
On 27 Jun 2013, at 17:46, aaron addleman <aaronaddleman@gmail.com> wrote:

> I have a Nesta site installed with Passenger in a subdirectory called 
/sg/. I have the entier site working, but I have been doing some ugly 
hacks to get the links in my theme to find the stylesheets. Currently I 
have been using:
> 
> %link{:href => "#{url('/stylesheets/fixes.css')}"
> 
> But maybe there is an easier way to do this by telling Sinatra where the
application is? Or is it Passenger that is confused? or Nesta? Or me?

Hi Aaron. You can tell Rack that it should be serving all requests at a 
specific path beneath the root. Sinatra uses Rack, and all paths within 
Nesta should then (relative to the root directory) be resolved okay. I 
haven't done it myself for quite some time though.

See the Rack::Builder docs for an example (specifically, the `map` call in
the example at the top):

http://rack.rubyforge.org/doc/classes/Rack/Builder.html

You can use the Rack::Builder API in your site's config.ru file.

Max and Micah did a bunch of work relating to running Nesta relative to a 
specific path a year or so ago. You can find a lot of it (and links to bug
reports that discuss this stuff in more detail) from here:

https://github.com/gma/nesta/commit/282c70c51f15edad4b34eaacbff9faad1cf9f2cd

If you get totally stuck feel free to send me more details, but I'd need 
nginx config, a copy of your site's code (e.g. access to a git repo) and a
clear description of exactly what you'd like it to do. It might take me a 
few days to get to it though...

Cheers,
Graham

-- 
Graham Ashton
Founder, Agile Planner
https://www.agileplannerapp.com | @agileplanner | @grahamashton