# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/

error_log /dev/stderr;
worker_rlimit_core 100m;
working_directory /tmp;
worker_processes 1;
pid /tmp/nginx.pid;

events {
    worker_connections 1024;
}

http {
    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;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /opt/nginx/conf/mime.types;
    default_type        application/octet-stream;

    server {
        listen       8080;
        server_name  _;
        root         /var/task/app/public;

        index index.php index.html index.htm;

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

        location ~ \.(php|phar)(/.*)?$ {
            fastcgi_split_path_info  ^(.+\.(?:php|phar))(/.*)$;
            fastcgi_intercept_errors on;
            fastcgi_index            index.php;
            include                  /opt/nginx/conf/fastcgi_params;
            fastcgi_param            SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param            PATH_INFO $fastcgi_path_info;
            fastcgi_pass             127.0.0.1:3000;
        }

    }

}