title: Serve static files through Nginx and uwsgi
body: <p>I'm struggling to let Nginx serve static files and tried out about every configuration option I could find. Here's the app's basic structure.</p>
  
  <pre><code>ROOT
  |_ static
    |_css/
    |_js/
  |_ app.py
  </code></pre>
  
  <p>I've read Nginx docs about it, but the files do not seem to cache.
  Here's my <code>/etc/nginx/nginx.conf</code>:</p>
  
  <pre><code>user www-data;
  events {
    worker_connections 64;
  }
  http {
  
    gzip on; # Enables compression
    gzip_types
      "application/javascript;charset=utf-8" application/javascript text/javascript
      "text/css;charset=utf-8" text/css
      "text/plain;charset=utf-8" text/plain;
  
    server {
  
      listen 80;
      server_name www.domain.tk domain.tk;
  
      location /static/ {
        alias /home/myuser/myapp/static/;
        add_header  Cache-Control public;
        expires     14d;
        access_log  off;
      }
  
      location / {
        include     uwsgi_params;
        uwsgi_pass  unix:/home/myuser/myapp/myapp.sock; # REPLACE user
      }
     }
    }
  </code></pre>
  
  <p>I'm using a uWSGI server and a Flask application if that matters. The developer console says the app should leverage Browser caching, how do I configure Nginx to work with serving the static files?</p>