title: serving static files with Nginx and Puma Rails
body: <p>I am trying to configure Nginx + Rails + Puma with unix sockets but I was not able to serve my asests. I have following configurations I would appreciate if someone could point what is missing. My Nginx configuration;</p>
  
  <pre><code>upstream my_app {
    server unix:///var/run/my_app.sock;
  }
  
  server {
    listen 8080;
    server_name _; 
    root /var/www/plantmonitorweb/public; # app location
  
    location / {
      proxy_pass http://my_app;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
  
    # this one is from Rails guides
    location ~ ^/assets/ {
      expires 1y;
      add_header Cache-Control public;
  
      add_header ETag "";
    }
  }
  </code></pre>
  
  <p>In production.rb </p>
  
  <pre><code>  config.public_file_server.enabled = false
    config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' 
  </code></pre>
  
  <p>puma.rb is not changed. I am running puma server with following command; </p>
  
  <pre><code>puma -e production -b unix:///var/run/my_app.sock
  </code></pre>
  
  <p>I run those in remote machine (Rasberry Pi to be specific) Puma runs fine it seems nginx is hitting my server but when I open chorome console I see following</p>
  
  <pre><code> GET http://192.168.1.35:8080/pack/app.js
  </code></pre>
  
  <p>I check this file under public/pack and it is there. </p>
  
  <p>My Nginx configuration is in /etc/nginx/conf.d/ which is included inside of Nginx.conf (include /etc/nginx/conf.d/*.conf)</p>