refine nginx configuration; generate SSL certificate if necessary