server {
    listen 80 default_server;
    # server_name  www.example.com example.com;
    root /app;

    index index.php index.html index.htm;

    location ~* ^/public/(css|fonts|images|js)/ {}
    location ~* ^/.*/assets/.* {}

    location / {
        rewrite ^/api/(.*)$ /api/index.php?/$1 last;
        rewrite ^/public/(.*)$ /public/index.php?/$1 last;
        try_files $uri $uri/ /index.php?/$request_uri;
    }

    location ~ \.php$ {
        # root html;
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
        # increase default buffers and timeouts
        fastcgi_buffers 8 16k;       # default is 8 4k|8k
        fastcgi_buffer_size 32k;     # default is 4k|8k
        fastcgi_connect_timeout 60s; # default is 60s
        fastcgi_send_timeout 300s;   # default is 60s
        fastcgi_read_timeout 300s;   # default is 60s
    }

    location ~* ^/(assets|files|robots\.txt) { }

    location ~ /\.ht {
        deny  all;
    }

#     error_page   404              /404.html;
#     # redirect server error pages to the static page /50x.html
#     #
#     error_page   500 502 503 504  /50x.html;
#     location = /50x.html {
#         root   /usr/share/nginx/html;
#     }

}
