0

I've generated YARD documentation, and it lives in /gem/doc/. I'd like to be able to serve that in my Rails app at /api/. I'd like to avoid symlinking to it in the /public directory, so I'm trying to configure nginx to serve these files.

Here's what I've tried so far, but it doesn't seem to be doing anything. I created a new file, config/nginx.conf, with the following:

server {
  listen 80;

  location /api/ {
    root gem/doc/;
    index index.html;
  }
}

How do I configure nginx to do this within my Rails app?

elstgav
  • 1,001
  • 7
  • 20
  • How are you feeding your application to nginx? – Ruby Racer Feb 23 '15 at 21:44
  • I have my rails app configured with unicorn, which I believe runs on top of nginx. All I did was add unicorn to the gemfile – elstgav Feb 23 '15 at 21:49
  • I guess you are using some default `nginx.conf` provided by unicorn... Anyway, you need to assign absolute path to the `root` field for the `location` directive. So, `/your/rails/app/gem/doc` or wherever... – Ruby Racer Feb 23 '15 at 21:58

0 Answers0