directory index of "..." is forbidden
<p>I am trying to get phusion passenger and nginx running on Mac OSX. It has been very difficult.</p>

<p>I followed the instructions <a href="https://www.phusionpassenger.com/library/install/nginx/install/oss/osx/" rel="nofollow">here</a> exactly.</p>

<pre><code>$ brew install nginx --with-passenger
$ brew info nginx --with-passenger 
</code></pre>

<p>Then it tells me this:</p>

<blockquote>
  <p>To activate Phusion Passenger, add this to
  /usr/local/etc/nginx/nginx.conf, inside the 'http' context:<br>
  passenger_root /usr/local/opt/passenger/libexec/src/ruby_supportlib/phusion_passenger/locations.ini;
  passenger_ruby /usr/bin/ruby;</p>
</blockquote>

<p>What's interesting about that is that is not the ruby my site uses. I use rvm and have generated a <code>.versions.conf</code> file:</p>

<pre><code>rvm --create --versions-conf use ruby-2.1.2@core
</code></pre>

<p>Hence, when you cd to my root folder of site, you get the following:</p>

<pre><code>$ rvm-prompt
ruby-2.1.2@core
</code></pre>

<p>So that is what I added to nginx.conf:</p>

<pre><code>http {
  ...
  passenger_root /usr/local/opt/passenger/libexec/src/ruby_supportlib/phusion_passenger/locations.ini;
  passenger_ruby /Users/dviglione/.rvm/gems/ruby-2.1.2@core/wrappers/ruby;
</code></pre>

<p>Note that when I run passenger-config, it does give me a different location for locations.ini:</p>

<pre><code>$ /usr/local/bin/passenger-config --root
/usr/local/Cellar/passenger/5.0.26/libexec/src/ruby_supportlib/phusion_passenger/locations.ini
</code></pre>

<p>I don't know which location is correct but I stuck with the one that it provided during the install. If I changed to the other location, I get a different issue: "This site can't be reached".</p>

<p>In nginx.conf, my server block looks like this:</p>

<pre><code>server {
    rack_env development;
    listen       8080;
    server_name  mysite_development;
    root /Users/myuser/projects/core;
    access_log /Users/myuser/projects/core/log/nginx_access.log;
    error_log /Users/myuser/projects/core/log/nginx_error.log;
    passenger_enabled on;
}
</code></pre>

<p>I added the following to /etc/hosts:</p>

<pre><code> 127.0.0.1       mysite_development
 255.255.255.255 broadcasthost
 ::1             localhost 
 fe80::1%lo0     localhost
</code></pre>

<p>The root directory has the following permissions:</p>

<pre><code>$ ls -ld core
drwxr-xr-x  37 myuser  CORP\Domain Users  1258 Oct 14 18:45 core
</code></pre>

<p>Yet, when I navigate to <a href="http://mysite_development:8080/" rel="nofollow">http://mysite_development:8080/</a>, I get the following error in my nginx error log:</p>

<blockquote>
  <p>2016/10/14 18:52:23 [error] 90766#0: *1 directory index of
  "/Users/myuser/projects/core/" is forbidden, client: 127.0.0.1,
  server: mysite_development, request: "GET / HTTP/1.1", host:
  "mysite_development:8080"</p>
</blockquote>

<p>The problem is not with nginx itself because I created a test folder and put an index.html in there and then created a server block for that and the index.html successfully displayed in browser. So problem is either with Passenger or Rails.</p>

<p>Note if I add this to the server block:</p>

<pre><code>    location / {
        root   html;
        index  index.html index.htm;
    }
</code></pre>

<p>Then I just get the 'Welcome to nginx!' page.</p>

<p>I even <code>chmod 777</code> recursively on the entire directory and its files of the Rails app. Still get the 403 Forbidden error. It has to be a problem with Passenger.</p>

<p>How can I resolve this?</p>