upstream phpfcgi {
    server php:9000;
    # server unix:/var/run/php5-fpm.sock; #for PHP-FPM running on UNIX socket
}

server {
    listen 80;

    # only for getting traffic from collabora, when opening nginx:8001
    listen 8001;

    #server_name symfony4;
    root /var/www/app/public;

    error_log /dev/stderr;
    access_log /dev/stdout main;

    location / {
        index index.php;
        try_files $uri /index.php$is_args$args;
    }

    location /build/ {
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public";

        gzip_static on;
        gzip_types
          application/atom+xml
          application/geo+json
          application/javascript
          application/x-javascript
          application/json
          application/ld+json
          application/manifest+json
          application/rdf+xml
          application/rss+xml
          application/xhtml+xml
          application/xml
          font/eot
          font/otf
          font/ttf
          image/svg+xml
          text/css
          text/javascript
          text/plain
          text/xml;
    }

    location ~ ^/index\.php(/|$) {
        fastcgi_pass phpfcgi;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $document_root;
        fastcgi_param HTTPS off;

        fastcgi_buffers 16 16k;
        fastcgi_buffer_size 32k;
        proxy_buffer_size 16k;
        proxy_busy_buffers_size 16k;

        http2_push_preload on;
    }

    location ~ \.php$ {
        return 404;
    }
}