Refine nginx config for ssl connections. Implements #67 and #92