use nginx instead of flask to serve media, fix huge memory leak