nginx alias not working for static files folder
<p>I don't know why nginx alias is not working.</p>

<p>Why this line doesn't work:</p>

<pre><code>location /static/  {
            alias /home/django11/example.com/finansuinfo/static_root/;
        }
</code></pre>

<p>Actually maybe it is working but my admin page static files isn't served. I get error that static/admin/... doesn't exist.</p>

<p>I guess it only serves files in static folder but not in static_root folder where all files are collected by manage.py collectstatic</p>

<p>Here is my config:</p>

<pre><code>server {
listen 80;
server_name example.com www.example.com;
root /home/django11/example.com/example;

location / {
    include         uwsgi_params;
    uwsgi_pass      unix:/home/django11/example.com/example/example.sock;
}

location /static/  {
    alias /home/django11/example.com/example/static_root/;
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
  expires 1M;
  access_log off;
  add_header Cache-Control "public";
}

# CSS and Javascript
location ~* \.(?:css|js|woff)$ {
  expires 1M;
  access_log off;
  add_header Cache-Control "public";
}
</code></pre>

<p>}</p>

<p>I found out that alias doesn't work because of:</p>

<pre><code># Media: images, icons, video, audio, HTC
    location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
      expires 1M;
      access_log off;
      add_header Cache-Control "public";
    }

    # CSS and Javascript
    location ~* \.(?:css|js|woff)$ {
      expires 1M;
      access_log off;
      add_header Cache-Control "public";
    }
</code></pre>

<p>Do you have any suggestions how to fix it? Because when I remove this static_root works.</p>