init 1.24.0.3.4
This commit is contained in:
parent
9236123892
commit
ef3304b263
3 changed files with 208 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
nginx-1.24.0.tar.gz
|
||||||
|
nginx-module-geoip2-3.4.tar.gz
|
2
.nginx-module-geoip2.metadata
Normal file
2
.nginx-module-geoip2.metadata
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
1114e37de5664a8109c99cfb2faa1f42ff8ac63c932bcf3780d645e5ed32c0b2ac446f80305b4465994c8f9430604968e176ae464fd80f632d1cb2c8f6007ff3 SOURCES/nginx-1.24.0.tar.gz
|
||||||
|
5f0390dc3bee4888c3a6014f590c4f29cc30ec6dde96d4c426cc342069570d7d6fb5bc687e2573e08f79b48a379728adacd4e6520a071aa8b102a5f010db4096 SOURCES/nginx-module-geoip2-3.4.tar.gz
|
204
SPECS/nginx-module-geoip2.spec
Normal file
204
SPECS/nginx-module-geoip2.spec
Normal file
|
@ -0,0 +1,204 @@
|
||||||
|
#
|
||||||
|
%define nginx_user nginx
|
||||||
|
%define nginx_group nginx
|
||||||
|
|
||||||
|
%define __arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
|
||||||
|
|
||||||
|
%if 0%{?rhel} || 0%{?amzn} || 0%{?fedora}
|
||||||
|
%define _group System Environment/Daemons
|
||||||
|
%if 0%{?amzn} == 2
|
||||||
|
BuildRequires: openssl11-devel
|
||||||
|
%else
|
||||||
|
BuildRequires: openssl-devel
|
||||||
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?suse_version} >= 1315
|
||||||
|
%define _group Productivity/Networking/Web/Servers
|
||||||
|
BuildRequires: libopenssl-devel
|
||||||
|
%define _debugsource_template %{nil}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if (0%{?rhel} == 7) && (0%{?amzn} == 0)
|
||||||
|
%define epoch 2
|
||||||
|
Epoch: %{epoch}
|
||||||
|
%define dist .el7
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if (0%{?rhel} == 7) && (0%{?amzn} == 2)
|
||||||
|
%define epoch 2
|
||||||
|
Epoch: %{epoch}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?rhel} == 8
|
||||||
|
%define epoch 2
|
||||||
|
Epoch: %{epoch}
|
||||||
|
%define _debugsource_template %{nil}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?rhel} == 9
|
||||||
|
%define epoch 2
|
||||||
|
Epoch: %{epoch}
|
||||||
|
%define _debugsource_template %{nil}
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%if 0%{?fedora}
|
||||||
|
%define _debugsource_template %{nil}
|
||||||
|
%global _hardened_build 1
|
||||||
|
%endif
|
||||||
|
|
||||||
|
BuildRequires: libmaxminddb-devel
|
||||||
|
|
||||||
|
%define base_version 1.24.0
|
||||||
|
%define base_release 1%{?dist}.ngx
|
||||||
|
%define module_version 3.4
|
||||||
|
%define module_release 1%{?dist}.ngx
|
||||||
|
|
||||||
|
%define bdir %{_builddir}/%{name}-%{base_version}
|
||||||
|
|
||||||
|
Summary: nginx GeoIP2 dynamic module
|
||||||
|
Name: nginx-module-geoip2
|
||||||
|
Version: %{base_version}.%{module_version}
|
||||||
|
Release: %{module_release}
|
||||||
|
|
||||||
|
URL: https://nginx.org/
|
||||||
|
Group: %{_group}
|
||||||
|
|
||||||
|
Source0: https://nginx.org/download/nginx-%{base_version}.tar.gz
|
||||||
|
Source100: %{name}-%{module_version}.tar.gz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
License: 2-clause BSD-like license
|
||||||
|
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{base_version}-%{base_release}-root
|
||||||
|
BuildRequires: zlib-devel
|
||||||
|
BuildRequires: pcre-devel
|
||||||
|
BuildRequires: pcre2-devel
|
||||||
|
Requires: nginx-r%{base_version}
|
||||||
|
Provides: %{name}-r%{base_version}.%{module_version}
|
||||||
|
|
||||||
|
%description
|
||||||
|
nginx geoip2 dynamic module.
|
||||||
|
|
||||||
|
%if 0%{?suse_version}
|
||||||
|
%debug_package
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%define WITH_CC_OPT $(echo %{optflags} $(pcre2-config --cflags))
|
||||||
|
%define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now
|
||||||
|
|
||||||
|
%define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx --sbin-path=%{_sbindir}/nginx --modules-path=%{_libdir}/nginx/modules --conf-path=%{_sysconfdir}/nginx/nginx.conf --error-log-path=%{_localstatedir}/log/nginx/error.log --http-log-path=%{_localstatedir}/log/nginx/access.log --pid-path=%{_localstatedir}/run/nginx.pid --lock-path=%{_localstatedir}/run/nginx.lock --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp --user=%{nginx_user} --group=%{nginx_group} --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module")
|
||||||
|
%define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=%{name}-%{module_version}")
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%setup -qcTn %{name}-%{base_version}
|
||||||
|
tar --strip-components=1 -zxf %{SOURCE0}
|
||||||
|
tar xvzf %SOURCE100
|
||||||
|
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
cd %{bdir}
|
||||||
|
|
||||||
|
%if 0%{?rhel} == 7
|
||||||
|
sed \
|
||||||
|
-e 's|\(ngx_feature_path=\)$|\1%{_includedir}/openssl11|' \
|
||||||
|
-e 's|\(ngx_feature_libs="\)|\1-L%{_libdir}/openssl11 |' \
|
||||||
|
-i auto/lib/openssl/conf
|
||||||
|
%endif
|
||||||
|
|
||||||
|
./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
|
||||||
|
--with-cc-opt="%{WITH_CC_OPT} " \
|
||||||
|
--with-ld-opt="%{WITH_LD_OPT} " \
|
||||||
|
--with-debug
|
||||||
|
make %{?_smp_mflags} modules
|
||||||
|
for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
|
||||||
|
debugso=`echo $so | sed -e 's|\.so$|-debug.so|'`
|
||||||
|
mv $so $debugso
|
||||||
|
done
|
||||||
|
|
||||||
|
./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
|
||||||
|
--with-cc-opt="%{WITH_CC_OPT} " \
|
||||||
|
--with-ld-opt="%{WITH_LD_OPT} "
|
||||||
|
make %{?_smp_mflags} modules
|
||||||
|
|
||||||
|
%install
|
||||||
|
cd %{bdir}
|
||||||
|
%{__rm} -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
|
||||||
|
for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
|
||||||
|
%{__install} -m755 $so \
|
||||||
|
$RPM_BUILD_ROOT%{_libdir}/nginx/modules/
|
||||||
|
done
|
||||||
|
|
||||||
|
%check
|
||||||
|
%{__rm} -rf $RPM_BUILD_ROOT/usr/src
|
||||||
|
cd %{bdir}
|
||||||
|
grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
|
||||||
|
cat /dev/null > debugsources.list
|
||||||
|
%if 0%{?suse_version} >= 1500
|
||||||
|
cat /dev/null > debugsourcefiles.list
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%clean
|
||||||
|
%{__rm} -rf $RPM_BUILD_ROOT
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_libdir}/nginx/modules/*
|
||||||
|
|
||||||
|
%post
|
||||||
|
if [ $1 -eq 1 ]; then
|
||||||
|
cat <<BANNER
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
The GeoIP2 dynamic modules for nginx have been installed.
|
||||||
|
To enable these modules, add the following to /etc/nginx/nginx.conf
|
||||||
|
and reload nginx:
|
||||||
|
|
||||||
|
load_module modules/ngx_http_geoip2_module.so;
|
||||||
|
load_module modules/ngx_stream_geoip2_module.so;
|
||||||
|
|
||||||
|
Download Maxmind GeoLite2 Database:
|
||||||
|
http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz
|
||||||
|
http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz
|
||||||
|
|
||||||
|
Example Usage:
|
||||||
|
|
||||||
|
http {
|
||||||
|
...
|
||||||
|
geoip2 /etc/maxmind-country.mmdb {
|
||||||
|
auto_reload 5m;
|
||||||
|
\$geoip2_metadata_country_build metadata build_epoch;
|
||||||
|
\$geoip2_data_country_code default=US source=\$variable_with_ip country iso_code;
|
||||||
|
\$geoip2_data_country_name country names en;
|
||||||
|
}
|
||||||
|
|
||||||
|
geoip2 /etc/maxmind-city.mmdb {
|
||||||
|
\$geoip2_data_city_name default=London city names en;
|
||||||
|
}
|
||||||
|
....
|
||||||
|
|
||||||
|
fastcgi_param COUNTRY_CODE \$geoip2_data_country_code;
|
||||||
|
fastcgi_param COUNTRY_NAME \$geoip2_data_country_name;
|
||||||
|
fastcgi_param CITY_NAME \$geoip2_data_city_name;
|
||||||
|
....
|
||||||
|
}
|
||||||
|
|
||||||
|
stream {
|
||||||
|
...
|
||||||
|
geoip2 /etc/maxmind-country.mmdb {
|
||||||
|
\$geoip2_data_country_code default=US source=$remote_addr country iso_code;
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
BANNER
|
||||||
|
fi
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue Apr 18 2023 Sergey Bondarev <s.bondarev@southbridge.ru> - 1.24.0-1%{?dist}.ngx
|
||||||
|
- base version updated to 1.24.0-1
|
Loading…
Add table
Reference in a new issue