Add nginx config and fixed some bugs