rpm: added separate dist for CentOS 7.4.
diff --git a/rpm/SPECS/nginx-module.spec.in b/rpm/SPECS/nginx-module.spec.in
index cc0d558..7863be2 100644
--- a/rpm/SPECS/nginx-module.spec.in
+++ b/rpm/SPECS/nginx-module.spec.in
@@ -2,8 +2,6 @@
 %define nginx_user nginx
 %define nginx_group nginx
 
-%%MODULE_DEFINITIONS%%
-
 %if 0%{?rhel} || 0%{?amzn}
 %define _group System Environment/Daemons
 BuildRequires: openssl-devel
@@ -17,8 +15,15 @@
 %if 0%{?rhel} == 7
 %define epoch 1
 Epoch: %{epoch}
+%define openssl_version %(rpmquery openssl | cut -c 9-13)
+%if "%{openssl_version}" == "1.0.2"
+%define dist .el7.4
+%else
 %define dist .el7
 %endif
+%endif
+
+%%MODULE_DEFINITIONS%%
 
 %define main_version %%MAIN_VERSION%%
 %define main_release %%MAIN_RELEASE%%%{?dist}.ngx
diff --git a/rpm/SPECS/nginx-plus-module.spec.in b/rpm/SPECS/nginx-plus-module.spec.in
index b3eba6b..963d1da 100644
--- a/rpm/SPECS/nginx-plus-module.spec.in
+++ b/rpm/SPECS/nginx-plus-module.spec.in
@@ -2,8 +2,6 @@
 %define nginx_user nginx
 %define nginx_group nginx
 
-%%MODULE_DEFINITIONS%%
-
 %if 0%{?rhel} || 0%{?amzn}
 %define _group System Environment/Daemons
 BuildRequires: openssl-devel
@@ -15,8 +13,15 @@
 %endif
 
 %if 0%{?rhel} == 7
+%define openssl_version %(rpmquery openssl | cut -c 9-13)
+%if "%{openssl_version}" == "1.0.2"
+%define dist .el7.4
+%else
 %define dist .el7
 %endif
+%endif
+
+%%MODULE_DEFINITIONS%%
 
 %define main_version %%MAIN_VERSION%%
 %define main_release %%MAIN_RELEASE%%%{?dist}.ngx
diff --git a/rpm/SPECS/nginx.spec.in b/rpm/SPECS/nginx.spec.in
index e35bfb4..6bd7c05 100644
--- a/rpm/SPECS/nginx.spec.in
+++ b/rpm/SPECS/nginx.spec.in
@@ -31,11 +31,18 @@
 Epoch: %{epoch}
 Requires(pre): shadow-utils
 Requires: systemd
-Requires: openssl >= 1.0.1
 BuildRequires: systemd
+%define openssl_version %(rpmquery openssl | cut -c 9-13)
+%if "%{openssl_version}" == "1.0.2"
+Requires: openssl >= 1.0.2
+BuildRequires: openssl-devel >= 1.0.2
+%define dist .el7.4
+%else
+Requires: openssl >= 1.0.1
 BuildRequires: openssl-devel >= 1.0.1
 %define dist .el7
 %endif
+%endif
 
 %if 0%{?suse_version} == 1315
 %define _group Productivity/Networking/Web/Servers