fix nginx init and exit bug