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..dfc4f86 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
@@ -15,10 +13,18 @@
 %endif
 
 %if 0%{?rhel} == 7
+BuildRequires: redhat-lsb-core
 %define epoch 1
 Epoch: %{epoch}
+%define os_minor %(lsb_release -rs | cut -d '.' -f 2)
+%if %{os_minor} >= 4
+%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..2922019 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,16 @@
 %endif
 
 %if 0%{?rhel} == 7
+BuildRequires: redhat-lsb-core
+%define os_minor %(lsb_release -rs | cut -d '.' -f 2)
+%if %{os_minor} >= 4
+%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 6d48b62..a93f9d5 100644
--- a/rpm/SPECS/nginx.spec.in
+++ b/rpm/SPECS/nginx.spec.in
@@ -26,16 +26,24 @@
 %endif
 
 %if 0%{?rhel} == 7
+BuildRequires: redhat-lsb-core
 %define _group System Environment/Daemons
 %define epoch 1
 Epoch: %{epoch}
 Requires(pre): shadow-utils
 Requires: systemd
-Requires: openssl >= 1.0.1
 BuildRequires: systemd
+%define os_minor %(lsb_release -rs | cut -d '.' -f 2)
+%if %{os_minor} >= 4
+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