Initial nginx refactoring