Unable to serve the nested css & js files via nginx?
<p>I've read some documentation and tried and number of alternatives from previous answers on this site but cannot get nginx to serve my css &amp; js files from my flask app.  In my code i have for example:</p>

<pre><code>&lt;link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}"/&gt;

&lt;script type="text/javascript" src=" ../static/js/jquery.tablesorter.js"&gt;&lt;/script&gt;
</code></pre>

<p>and my file structure looks like this:
<a href="http://i.stack.imgur.com/4g8G5.png" rel="nofollow"><img src="http://i.stack.imgur.com/4g8G5.png" alt="file structure"></a></p>

<p>In my nginx config '/etc/nginx/sites-enabled/src' I am able to get the html files within templates to serve ok and also able to get the 'log_big.png' file within the static folder to serve ok... but I cannot get the 3rd location entry to work and serve these nested files:</p>

<pre><code>server {
location / {
    proxy_pass http://localhost:8000;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
}
location /templates {
    alias  /home/www/src/templates/;  # This works ok for html files
}
location /static/ {
    alias  /home/www/src/static/;  # This works ok for the .png file
}
location /CSS/ {
    autoindex on;
    root  /home/www/src/static/;   # This doesn't work ?
}

include /etc/nginx/mime.types;
}
</code></pre>

<p>Can anyone advise what I am doing wrong please?</p>

<p>Not only do you mix the case (<code>CSS</code> vs <code>css</code>), you include <code>../static/</code> in the JavaScript path. Fix the capitalization and remove the <code>../static/</code>.</p>

python nginx flask gunicorn nginx-location