Felhasználói eszközök

Eszközök a webhelyen


geoip2:nginx

Ez a dokumentum egy előző változata!


NGINX GeoIP2 modul

Dinamikus modul fordítása

Az NGINX szerverhez használható nyílt forráskódú geoip2 modul legfrissebb változata a https://github.com/leev/ngx_http_geoip2_module oldalról tölthető le. A fordításhoz szükség van a gépen futó nginx szerver verziójának forráskódjára, amely a https://nginx.org/en/download.html oldalon érhető el.

Előkészítő műveletek

Telepíteni kell a szükséges csomagokat.

# dnf install gcc libmaxminddb-devel make tar

Meg kell határozni a használt nginx szerver verziót.

# nginx -V 2>&1 | grep '^nginx version:'
nginx version: nginx/1.29.5

A megfelelő verziót le kell tölteni, majd ki kell csomagolni.

# curl -L -O https://nginx.org/download/nginx-1.29.5.tar.gz

# tar -C /usr/local/src -xzf nginx-1.29.5.tar.gz

Le kell tölteni és ki kell csomagolni az ngx_http_geoip2 modult.

# curl -L -o ngx_http_geoip2_module.tar.gz https://github.com/leev/ngx_http_geoip2_module/archive/refs/tags/3.4.tar.gz

# tar -C /usr/local/src -xzf ngx_http_geoip2_module.tar.gz

Fordítás

Meg kell határozni a szükséges fordítási paramétereket, amelyek a futó nginx példányból kinyerhető. Ezt a hosszú karaktersorozatot használjuk a fordítás során.

# nginx -V 2>&1 | grep '^configure arguments:'
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --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-http_v3_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

Be kell lépni az nginx forráskódjának könyvtárába és el kell végezni a konfigurálást. A configure utasítás paramétere a korábban kiolvasott argumentumlista. Ehhez kell hozzáadni a modulhoz kapcsolódó plusz két kapcsolót.

  • –with-compat
  • –add-dynamic-module=/usr/local/src/ngx_http_geoip2_module-3.4

Az –add-dynamic-module= paramétere a használni kívánt modul forráskódjának könyvtára.

<code> # cd /usr/local/src/nginx-1.29.5

# ./configure –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –modules-path=/usr/lib64/nginx/modules –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –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-http_v3_module –with-mail –with-mail_ssl_module –with-stream –with-stream_realip_module –with-stream_ssl_module –with-stream_ssl_preread_module –with-cc-opt='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC' –with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' –with-compat –add-dynamic-module=/usr/local/src/ngx_http_geoip2_module-3.4

geoip2/nginx.1771474388.txt.gz · Utolsó módosítás: szerkesztette: riba.zoltan