add support for nginx plugin also and share some code base