title: nginx returns 404 for css/static files
body: <p>I am running symfony on nginx in a docker container with the following very basic default.conf:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>server {
      server_name localhost;
      root /var/www/symfony/public;
  
      location / {
          try_files $uri /index.php$is_args$args;
      }
  
      location ~ ^/index\.php(/|$) {
          fastcgi_pass php-fpm:9000;
          fastcgi_split_path_info ^(.+\.php)(/.*)$;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param HTTPS off;
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>My nginx.conf looks like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>worker_processes 4;
  
  events {
    worker_connections  2048;
    multi_accept on;
    use epoll;
  }
  
  pid         /var/run/nginx.pid;
  
  http {
      include /etc/nginx/mime.types;
      default_type application/octet-stream;
  
      log_format main '$remote_addr - $remote_user [$time_local] "$request" '
      '$status $body_bytes_sent "$http_referer" '
      '"$http_user_agent" "$http_x_forwarded_for"';
  
      sendfile on;
  
      keepalive_timeout 65;
  
      gzip on;
      gzip_disable "msie6";
  
      gzip_vary on;
      gzip_proxied any;
      gzip_comp_level 6;
      gzip_buffers 16 8k;
      gzip_http_version 1.1;
      gzip_types text/plain text/css application/json application/x-javascript
                 text/xml application/xml application/xml+rss text/javascript;
  
      include /etc/nginx/conf.d/*.conf;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Somehow I am not able to get static files from the public/ directory, nginx says /var/www/symfony/public/style.css could not be found (404) – but the file definitely exists in the given path. So I am guessing my nginx configuration must be wrong, but I cannot find the error. Shouldn't the following snippet return an existing file first before rewriting to index.php (I am getting the 404 error from symfony, so somehow it's rewriting to index.php even if the file exists):</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>location / {
    try_files $uri /index.php$is_args$args;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Edit: I am not using assetic.</p>