title: Configure nginx.conf for Rails Shows File Directory Not Index
body: <p>Here is what I have in my nginx.conf:</p>
  
  <pre><code>#user  nobody;
  worker_processes  1;
  #error_log  logs/error.log;
  #error_log  logs/error.log  notice;
  #error_log  logs/error.log  info;
  #pid        logs/nginx.pid;
  events {
      worker_connections  1024;
       }
  http {
      passenger_root /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.11;
      passenger_ruby /usr/bin/ruby;
      include       mime.types;
      default_type  application/octet-stream;
      sendfile        on;
      #tcp_nopush     on;
      #keepalive_timeout  0;
      keepalive_timeout  65;
  
      gzip  on;
      gzip_http_version 1.1;
      gzip_comp_level 2;
      gzip_types    text/plain text/html text/css
                    application/x-javascript text/xml
                    application/xml application/xml+rss
                    text/javascript;
      server {
          listen       80;
          server_name  domain.com www.domain.com;
  
          # autoindex on;
          passenger_enabled on;
          rails_env production;
  
          access_log  logs/mrfs.access.log;
  
          location / {
              root   /opt/nginx/html/mrfs/public; #line updated per suggestion below
          }
  
          }
    }
  </code></pre>
  
  <p>I can toggle the autoindex on and off and it will display a 403 error when it is commented out or a directory listing when it is on. When I have access to the directory listings, I can surf them and download various files. This seems to me to make it not a permissions issue. When I have auto index disabled I get a can not list directory error in the error log. I think what I need to do is tell nginx how to load my index.html.erb file? How do I do that? Is that what is wrong?</p>
  
  <p><em><strong>Update</em></strong></p>
  
  <p>I put an 'index.html' in my /opt/nginx/html/mrfs/public folder and it loads that. So what would cause rails/nginx/passenger to load index.html file in public, but not load the home.html.erb file in my routes? I can run 'rails s' and then do a wget <a href="http://localhost" rel="nofollow">http://localhost</a> and it pulls down the right html file.</p>