user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


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"';

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

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip  off;

    #include /etc/nginx/conf.d/*.conf;

    # permet l'upload de fichiers
    client_max_body_size 3M;

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

server {
    listen 80;
    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";
    }

    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;
    }

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

}