general refactoring for nginx env