{"id":381069,"date":"2024-06-29T03:27:36","date_gmt":"2024-06-29T03:27:36","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=381069"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=381069","title":{"rendered":"<span>\u0411\u043b\u043e\u043a\u0438\u0440\u0443\u0435\u043c \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439 \u0441\u0430\u0439\u0442\u043e\u0432 \u043f\u043e IP<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 L7 DDoS-\u0430\u0442\u0430\u043a.\u00a0 \u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043b\u0451\u0433\u043a\u0438\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439.  <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5c7\/3f0\/d84\/5c73f0d84e2d3b03c46c7bdf4eec835b.png\" width=\"996\" height=\"444\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5c7\/3f0\/d84\/5c73f0d84e2d3b03c46c7bdf4eec835b.png\"\/><\/figure>\n<p>\u0412 2022 \u0433\u043e\u0434\u0443 \u0431\u044b\u043b \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u044b \u043d\u0430\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0438 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f L7 DDoS-\u0430\u0442\u0430\u043a\u0438. \u041d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0441\u0442\u043e\u044f\u0442\u044c.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438\u00a0 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u0443\u043c \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0430\u0439\u0442\u0430\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435 \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u0413\u0435\u043e\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 Nginx, \u0430 \u0433\u043b\u0430\u0432\u043d\u0430\u044f\u00a0 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0433\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f (\u0441\u0442\u0440\u0430\u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430).<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0442\u043e\u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043f\u0440\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 2002 \u0433\u043e\u0434\u0430: MaxMind. \u041e\u043d \u0432\u0435\u0434\u0451\u0442 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e\u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441: MaxMind \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP Legacy \u0441 31 \u043c\u0430\u044f 2022 \u0433. \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP2. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a <a href=\"https:\/\/xn--80adjigxbghjs.xn--p1ai\/company\/832-maxmind.html\"><u>\u0443\u0448\u0451\u043b \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438<\/u><\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/12b\/ef5\/ff2\/12bef5ff23f26b76b69ee68530273e3f.png\" alt=\"\" title=\"\" width=\"975\" height=\"997\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/12b\/ef5\/ff2\/12bef5ff23f26b76b69ee68530273e3f.png\"\/><\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u0443\u0442\u044c \u043f\u0438\u0441\u044c\u043c\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c GeoLite!<\/p>\n<p>\u0412 \u0446\u0435\u043b\u044f\u0445 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0441\u0430\u043d\u043a\u0446\u0438\u0439 \u0421\u0428\u0410 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 MaxMind \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0432\u043e\u0451 \u043f\u0440\u0430\u0432\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c GeoLite2 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c 10 (b) \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0441 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c GeoLite2.\u00a0<\/p>\n<p>\u0423\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c GeoLite2 \u0432 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a, 25 \u0430\u043f\u0440\u0435\u043b\u044f 2022 \u0433.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 MaxMind \u0438\u0437 \u0420\u0424 (\u0441 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u043c \u0434\u043e\u043c\u0435\u043d\u043e\u043c RU), \u043d\u043e \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0420\u043e\u0441\u0441\u0438\u044e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aab\/a54\/704\/aaba54704e85d5514f0fa6f87e84e42d.png\" alt=\"\" title=\"\" width=\"1140\" height=\"609\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/aab\/a54\/704\/aaba54704e85d5514f0fa6f87e84e42d.png\"\/><\/figure>\n<p>\u0412\u044b\u0431\u0440\u0430\u043b \u0422\u0443\u0440\u0446\u0438\u044e \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 VPN \u0438\u043b\u0438 PROXY). \u041d\u0443, \u0434\u0435\u043b\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0441 \u0442\u0443\u0440\u0435\u0446\u043a\u043e\u0433\u043e IP. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u0437\u044b Geo2Lite.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u0437 Geolite\/Geo2lite \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0431\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0421\u041c\u0421. \u0418\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/www.miyuru.lk\/geoiplegacy\"><u>GeoIP Legacy<\/u><\/a>. \u0421 \u043c\u0430\u044f 2022 \u0433\u043e\u0434\u0430 \u043e\u0434\u0438\u043d \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0431\u0430\u0437\u044b \u0441 Geo2 \u0432 Geo, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0434\u0430\u0442\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0411\u0414.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 Geo2 \u0435\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/P3TERX\/GeoLite.mmdb\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a> \u0431\u0430\u0437\u0430\u043c\u0438, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u0431\u0440\u0430\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u041e\u0421 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c GeoIP \u0434\u043b\u044f Nginx.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u043d\u0430\u0441 Ubuntu 20\/22, \u0442\u043e \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f GeoIP \u0438 geo GeoIP2 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u043f\u0430\u0445:<\/p>\n<pre><code>libnginx-mod-http-geoip2 libnginx-mod-http-geoip<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e: <code>apt install libnginx-mod-http-geoip2<\/code> \u043b\u0438\u0431\u043e <code>apt install libnginx-mod-http-geoip<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u043e\u0438\u0442, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c CentOS 8, \u0442\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u043f\u0430\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044c. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0432\u0430\u0442\u044c Nginx, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c geoip2. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0434\u0443\u043b\u044c geoip2 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 Nginx, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx Plus.<\/p>\n<p>\u041d\u043e \u0441\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0435\u0441\u0442\u044c \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435, \u043e\u0442\u0442\u0443\u0434\u0430 \u0435\u0433\u043e \u0438 \u0432\u043e\u0437\u044c\u043c\u0451\u043c.<\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0441\u0431\u043e\u0440\u043a\u0438.\u00a0<\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0435\u0440\u0432\u044b\u0439<\/strong>: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a Nginx.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439<\/strong>: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433, \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u044f \u0432\u0435\u0441\u044c Nginx.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f Nginx \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx. \u0411\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430 CentOS 8.<\/p>\n<p>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u0443 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c GeoIP2:<\/p>\n<pre><code>git clone https:\/\/github.com\/leev\/ngx_http_geoip2_module.git <\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 MaxMind \u0432 CentOS 8, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0441\u0442\u044c \u0432 \u0440\u0435\u043f\u0430\u0445, <code>yum install libmaxminddb.x86_64<\/code>, \u043b\u0438\u0431\u043e <a href=\"https:\/\/github.com\/maxmind\/libmaxminddb\"><u>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u0435\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a Nginx \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0423\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>nginx -v<\/code><\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:\u00a0 <code>nginx version: nginx\/1.14.1<\/code><\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx<\/p>\n<pre><code>wget http:\/\/nginx.org\/download\/nginx-1.14.1.tar.gz tar -xvf\u00a0 nginx-1.14.1.tar.gz cd nginx-1.14.1\/<\/code><\/pre>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u0441 <code>nginx -V<\/code>, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0451 \u043f\u043e\u0441\u043b\u0435 <code>--prefix=\/...<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u00a0 <code>--add-module=\/root\/ngx_http_geoip2_module<\/code> (\u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0443\u043b\u044e, \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0433\u0438\u0442\u0445\u0430\u0431\u0430).<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<p>.\/configure &#8212;prefix=\/usr\/share\/nginx &#8212;sbin-path=\/usr\/sbin\/nginx &#8212;modules-path=\/usr\/lib64\/nginx\/modules &#8212;conf-path=\/etc\/nginx\/nginx.conf &#8212;error-log-path=\/var\/log\/nginx\/error.log &#8212;http-log-path=\/var\/log\/nginx\/access.log &#8212;http-client-body-temp-path=\/var\/lib\/nginx\/tmp\/client_body &#8212;http-proxy-temp-path=\/var\/lib\/nginx\/tmp\/proxy &#8212;http-fastcgi-temp-path=\/var\/lib\/nginx\/tmp\/fastcgi &#8212;http-uwsgi-temp-path=\/var\/lib\/nginx\/tmp\/uwsgi &#8212;http-scgi-temp-path=\/var\/lib\/nginx\/tmp\/scgi &#8212;pid-path=\/run\/nginx.pid &#8212;lock-path=\/run\/lock\/subsys\/nginx &#8212;user=nginx &#8212;group=nginx &#8212;with-file-aio &#8212;with-ipv6 &#8212;with-http_ssl_module &#8212;with-http_v2_module &#8212;with-http_realip_module &#8212;with-http_addition_module &#8212;with-http_xslt_module=dynamic &#8212;with-http_image_filter_module=dynamic &#8212;with-http_sub_module &#8212;with-http_dav_module &#8212;with-http_flv_module &#8212;with-http_mp4_module &#8212;with-http_gunzip_module &#8212;with-http_gzip_static_module &#8212;with-http_random_index_module &#8212;with-http_secure_link_module &#8212;with-http_degradation_module &#8212;with-http_slice_module &#8212;with-http_stub_status_module &#8212;with-http_perl_module=dynamic &#8212;with-http_auth_request_module &#8212;with-mail=dynamic &#8212;with-mail_ssl_module &#8212;with-pcre &#8212;with-pcre-jit &#8212;with-stream=dynamic &#8212;with-stream_ssl_module &#8212;with-debug &#8212;with-cc-opt=&#8217;-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=\/usr\/lib\/rpm\/redhat\/redhat-hardened-cc1 -specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection&#8217; &#8212;with-ld-opt=&#8217;-Wl,-z,relro -Wl,-z,now -specs=\/usr\/lib\/rpm\/redhat\/redhat-hardened-ld -Wl,-E&#8217; &#8212;add-dynamic-module=\/root\/ngx_http_geoip2_module<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a:<\/p>\n<pre><code>yum install gcc gcc-c++ kernel-devel pcre-devel zlib-devel openssl-devel libxslt-devel install libgeoip-dev libgeoip-dev gd gd-devel perl-ExtUtils-Embed -y<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c make modules (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0430 \u043d\u0435 make install, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c Nginx).<\/p>\n<p>\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>\/root\/nginx-1.14.1\/objs\/ngx_http_geoip2_module.so<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c. <\/p>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432\u00a0 <code>\/usr\/share\/nginx\/modules\/<\/code> \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439   <code>cp ngx_http_geoip2_module.so \/usr\/share\/nginx\/modules\/ <\/code><\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435<\/p>\n<pre><code>\/etc\/nginx\/nginx.conf load_module modules\/ngx_http_geoip2_module.so;<\/code><\/pre>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0443 <code>\/usr\/share\/GeoIP\/<\/code> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 <code>GeoLite2-Country.mmdb<\/code>\u00a0<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 http \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c  <\/p>\n<pre><code>geoip2 \/usr\/share\/GeoIP\/GeoLite2-Country.mmdb {         $geoip2_data_country_iso_code country iso_code;         $geoip2_data_continent_code   continent code;     }    #\u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0432\u0441\u0435\u043c, \u043a\u0440\u043e\u043c\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d     map $geoip2_data_country_iso_code $allowed_country {        default no;        RU yes;     }<\/code><\/pre>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u0441\u044e\u0434\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u0431\u0430\u0437 Geo2Lite \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 MaxMind. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430, <a href=\"https:\/\/dev.maxmind.com\/geoip\/updating-databases\"><u>\u0432\u043e\u0442 \u0441\u0441\u044b\u043b\u043a\u0430<\/u><\/a>.<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0435\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 (\u043b\u0438\u0431\u043e \u0430\u0434\u0440\u0435\u0441\u0430).<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 http<\/p>\n<pre><code>  geo $exclusions {          default 0;          123.123.123.123 1;  # \u0441\u044e\u0434\u0430 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u0442\u0438 \u043b\u0438\u0431\u043e \u0430\u0434\u0440\u0435\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f         12.13.11.0\/24 1;     }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 server \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u00a0<\/p>\n<pre><code>if ($allowed_country = yes) {     set $exclusions 1; }  if ($exclusions = \"0\") {     return 403; }<\/code><\/pre>\n<p>\u041d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u0441\u0442\u0440\u0430\u043d, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 <code>log_format\u00a0 main<\/code> \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>$geoip2_data_country_iso_code<\/code><\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code>log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '                       '$status $body_bytes_sent \"$http_referer\" '                       '\"$http_user_agent\" \"$http_x_forwarded_for\"' \"$geoip2_data_country_iso_code\"; <\/code><\/pre>\n<p>\u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 403<\/p>\n<pre><code>        error_page 403 @not_allowed;                 location @not_allowed {                  try_files \/my_403_error.html 403;        } <\/code><\/pre>\n<p>\u0438 \u0441\u0430\u043c\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 root location. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <code>\/usr\/share\/nginx\/html\/my_403_error.html<\/code>  <\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0430\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>&lt;h1>Oops, error 403. Access denied.&lt;\/h1> &lt;p>You do not have permission to access the page, let's try to solve this problem together:&lt;\/p> &lt;li>Let us know by mail: mail@domain.com and we will try to solve the problem together.&lt;\/li> &lt;\/ul> <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a\u0438\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0443\u0433\u0440\u043e\u0437, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u043b\u043e, \u0430\u0442\u0430\u043a\u0438 \u0441\u043e\u0448\u043b\u0438 \u043d\u0430 \u043d\u0435\u0442.  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/735932\/\"> https:\/\/habr.com\/ru\/articles\/735932\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442! \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 L7 DDoS-\u0430\u0442\u0430\u043a.\u00a0 \u0415\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b, \u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u2014 \u043b\u0451\u0433\u043a\u0438\u0439 \u0438 \u0431\u044b\u0441\u0442\u0440\u044b\u0439.  <\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412 2022 \u0433\u043e\u0434\u0443 \u0431\u044b\u043b \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438, \u0447\u0442\u043e \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u0430\u0439\u0442\u044b \u043d\u0430\u0448\u0438\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432, \u0441\u0440\u0435\u0434\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u044b\u043b\u0438 \u0438 \u0433\u043e\u0441\u0443\u0434\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f L7 DDoS-\u0430\u0442\u0430\u043a\u0438. \u041d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0441\u0442\u043e\u044f\u0442\u044c.<\/p>\n<p>\u0421\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0438\u00a0 \u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e \u043d\u0430 \u0443\u043c \u2014 \u044d\u0442\u043e \u0437\u0430\u043f\u0440\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0430\u0439\u0442\u0430\u043c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u043d\u0435 \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e. \u0413\u0435\u043e\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 Nginx, \u0430 \u0433\u043b\u0430\u0432\u043d\u0430\u044f\u00a0 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u043e\u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0435\u0433\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0433\u043e \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f (\u0441\u0442\u0440\u0430\u043d\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430).<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0442\u043e\u0436\u0435 \u0437\u043d\u0430\u0435\u0442\u0435 \u043f\u0440\u043e \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 2002 \u0433\u043e\u0434\u0430: MaxMind. \u041e\u043d \u0432\u0435\u0434\u0451\u0442 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 IP-\u0430\u0434\u0440\u0435\u0441\u043e\u0432 \u0438 \u0438\u0445 \u043c\u0435\u0441\u0442\u043e\u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0435\u0441\u0442\u044c \u043d\u044e\u0430\u043d\u0441: MaxMind \u0441\u043e\u043e\u0431\u0449\u0438\u043b, \u0447\u0442\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP Legacy \u0441 31 \u043c\u0430\u044f 2022 \u0433. \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u043d\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445 GeoIP2. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0432\u0440\u043e\u0434\u0435 \u043a\u0430\u043a <a href=\"https:\/\/xn--80adjigxbghjs.xn--p1ai\/company\/832-maxmind.html\"><u>\u0443\u0448\u0451\u043b \u0438\u0437 \u0420\u043e\u0441\u0441\u0438\u0438<\/u><\/a>.<\/p>\n<figure class=\"full-width\"><\/figure>\n<details class=\"spoiler\">\n<summary>\u0421\u0443\u0442\u044c \u043f\u0438\u0441\u044c\u043c\u0430<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0423\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c GeoLite!<\/p>\n<p>\u0412 \u0446\u0435\u043b\u044f\u0445 \u0441\u043e\u0431\u043b\u044e\u0434\u0435\u043d\u0438\u044f \u0441\u0430\u043d\u043a\u0446\u0438\u0439 \u0421\u0428\u0410 \u0432 \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0440\u043e\u0441\u0441\u0438\u0439\u0441\u043a\u0438\u0445 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0439 MaxMind \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0432\u043e\u0451 \u043f\u0440\u0430\u0432\u043e \u043f\u0440\u0435\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0430\u0448 \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c GeoLite2 \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c 10 (b) \u041b\u0438\u0446\u0435\u043d\u0437\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u044f \u0441 \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c GeoLite2.\u00a0<\/p>\n<p>\u0423\u0447\u0451\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0431\u0430\u0437\u0430\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c GeoLite2 \u0432 \u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a, 25 \u0430\u043f\u0440\u0435\u043b\u044f 2022 \u0433.<\/p>\n<\/div>\n<\/details>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 MaxMind \u0438\u0437 \u0420\u0424 (\u0441 \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u043c \u0434\u043e\u043c\u0435\u043d\u043e\u043c RU), \u043d\u043e \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0420\u043e\u0441\u0441\u0438\u044e.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u044b\u0431\u0440\u0430\u043b \u0422\u0443\u0440\u0446\u0438\u044e \u2014 \u043e\u0448\u0438\u0431\u043a\u0430 (\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 VPN \u0438\u043b\u0438 PROXY). \u041d\u0443, \u0434\u0435\u043b\u043e \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0435 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u043d\u043e \u0441 \u0442\u0443\u0440\u0435\u0446\u043a\u043e\u0433\u043e IP. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u0430 \u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u043b\u0438\u0447\u043d\u044b\u0439 \u043a\u0430\u0431\u0438\u043d\u0435\u0442 \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0431\u0430\u0437\u044b Geo2Lite.<\/p>\n<p>\u0415\u0441\u0442\u044c \u0438 \u0432\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u0437 Geolite\/Geo2lite \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e, \u0431\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0421\u041c\u0421. \u0418\u043c\u0435\u044e \u0432 \u0432\u0438\u0434\u0443 \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/www.miyuru.lk\/geoiplegacy\"><u>GeoIP Legacy<\/u><\/a>. \u0421 \u043c\u0430\u044f 2022 \u0433\u043e\u0434\u0430 \u043e\u0434\u0438\u043d \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0431\u0430\u0437\u044b \u0441 Geo2 \u0432 Geo, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044f \u0434\u0430\u0442\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0411\u0414.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 Geo2 \u0435\u0441\u0442\u044c \u0432\u0442\u043e\u0440\u043e\u0439 \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u0447\u0435\u043b\u043e\u0432\u0435\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u0432 <a href=\"https:\/\/github.com\/P3TERX\/GeoLite.mmdb\"><u>\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/u><\/a> \u0431\u0430\u0437\u0430\u043c\u0438, \u043d\u043e, \u043a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u0431\u0435\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0434\u0430\u0442\u044b \u0430\u043a\u0442\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u0441 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u043e \u0442\u043e\u043c, \u0433\u0434\u0435 \u0431\u0440\u0430\u0442\u044c \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, \u043c\u044b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c. \u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u0430\u043a\u0430\u044f \u041e\u0421 \u0441\u0442\u043e\u0438\u0442 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c GeoIP \u0434\u043b\u044f Nginx.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u0443 \u043d\u0430\u0441 Ubuntu 20\/22, \u0442\u043e \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f GeoIP \u0438 geo GeoIP2 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u043f\u0430\u0445:<\/p>\n<pre><code>libnginx-mod-http-geoip2 libnginx-mod-http-geoip<\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u044f\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e: <code>apt install libnginx-mod-http-geoip2<\/code> \u043b\u0438\u0431\u043e <code>apt install libnginx-mod-http-geoip<\/code><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0442\u043e\u0438\u0442, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c CentOS 8, \u0442\u043e \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0440\u0435\u043f\u0430\u0445 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0443\u0436\u043d\u044b\u0439 \u043d\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044c. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0432\u0430\u0442\u044c Nginx, \u0447\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c geoip2. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u043e\u0434\u0443\u043b\u044c geoip2 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u0445 Nginx, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043b\u0430\u0442\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx Plus.<\/p>\n<p>\u041d\u043e \u0441\u0430\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0435\u0441\u0442\u044c \u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435, \u043e\u0442\u0442\u0443\u0434\u0430 \u0435\u0433\u043e \u0438 \u0432\u043e\u0437\u044c\u043c\u0451\u043c.<\/p>\n<p>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0441\u0431\u043e\u0440\u043a\u0438.\u00a0<\/p>\n<ul>\n<li>\n<p><strong>\u041f\u0435\u0440\u0432\u044b\u0439<\/strong>: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a Nginx.<\/p>\n<\/li>\n<li>\n<p><strong>\u0412\u0442\u043e\u0440\u043e\u0439<\/strong>: \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433, \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u044f \u0432\u0435\u0441\u044c Nginx.<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f Nginx \u0437\u0430\u043d\u043e\u0432\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx. \u0411\u043e\u043b\u0435\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c.<\/p>\n<p>\u0412\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043d\u0430 CentOS 8.<\/p>\n<p>\u041a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u0443 \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c GeoIP2:<\/p>\n<pre><code>git clone https:\/\/github.com\/leev\/ngx_http_geoip2_module.git <\/code><\/pre>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 MaxMind \u0432 CentOS 8, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0435\u0441\u0442\u044c \u0432 \u0440\u0435\u043f\u0430\u0445, <code>yum install libmaxminddb.x86_64<\/code>, \u043b\u0438\u0431\u043e <a href=\"https:\/\/github.com\/maxmind\/libmaxminddb\"><u>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/u><\/a>.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u0435\u043d \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a Nginx \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438. \u0423\u0437\u043d\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>nginx -v<\/code><\/p>\n<p>\u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:\u00a0 <code>nginx version: nginx\/1.14.1<\/code><\/p>\n<p>\u0421\u043a\u0430\u0447\u0430\u0435\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u043d\u0430\u0448\u0435\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Nginx<\/p>\n<pre><code>wget http:\/\/nginx.org\/download\/nginx-1.14.1.tar.gz tar -xvf\u00a0 nginx-1.14.1.tar.gz cd nginx-1.14.1\/<\/code><\/pre>\n<p>\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u044b\u0432\u043e\u0434 \u0441 <code>nginx -V<\/code>, \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0432\u0441\u0451 \u043f\u043e\u0441\u043b\u0435 <code>--prefix=\/...<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u00a0 <code>--add-module=\/root\/ngx_http_geoip2_module<\/code> (\u043f\u0443\u0442\u044c \u043a \u043c\u043e\u0434\u0443\u043b\u044e, \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0433\u0438\u0442\u0445\u0430\u0431\u0430).<\/p>\n<p>\u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0442\u0430\u043a\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>\u0412\u044b\u0432\u043e\u0434<\/summary>\n<div class=\"spoiler__content\">\n<p>.\/configure &#8212;prefix=\/usr\/share\/nginx &#8212;sbin-path=\/usr\/sbin\/nginx &#8212;modules-path=\/usr\/lib64\/nginx\/modules &#8212;conf-path=\/etc\/nginx\/nginx.conf &#8212;error-log-path=\/var\/log\/nginx\/error.log &#8212;http-log-path=\/var\/log\/nginx\/access.log &#8212;http-client-body-temp-path=\/var\/lib\/nginx\/tmp\/client_body &#8212;http-proxy-temp-path=\/var\/lib\/nginx\/tmp\/proxy &#8212;http-fastcgi-temp-path=\/var\/lib\/nginx\/tmp\/fastcgi &#8212;http-uwsgi-temp-path=\/var\/lib\/nginx\/tmp\/uwsgi &#8212;http-scgi-temp-path=\/var\/lib\/nginx\/tmp\/scgi &#8212;pid-path=\/run\/nginx.pid &#8212;lock-path=\/run\/lock\/subsys\/nginx &#8212;user=nginx &#8212;group=nginx &#8212;with-file-aio &#8212;with-ipv6 &#8212;with-http_ssl_module &#8212;with-http_v2_module &#8212;with-http_realip_module &#8212;with-http_addition_module &#8212;with-http_xslt_module=dynamic &#8212;with-http_image_filter_module=dynamic &#8212;with-http_sub_module &#8212;with-http_dav_module &#8212;with-http_flv_module &#8212;with-http_mp4_module &#8212;with-http_gunzip_module &#8212;with-http_gzip_static_module &#8212;with-http_random_index_module &#8212;with-http_secure_link_module &#8212;with-http_degradation_module &#8212;with-http_slice_module &#8212;with-http_stub_status_module &#8212;with-http_perl_module=dynamic &#8212;with-http_auth_request_module &#8212;with-mail=dynamic &#8212;with-mail_ssl_module &#8212;with-pcre &#8212;with-pcre-jit &#8212;with-stream=dynamic &#8212;with-stream_ssl_module &#8212;with-debug &#8212;with-cc-opt=&#8217;-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=\/usr\/lib\/rpm\/redhat\/redhat-hardened-cc1 -specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection&#8217; &#8212;with-ld-opt=&#8217;-Wl,-z,relro -Wl,-z,now -specs=\/usr\/lib\/rpm\/redhat\/redhat-hardened-ld -Wl,-E&#8217; &#8212;add-dynamic-module=\/root\/ngx_http_geoip2_module<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0438\u0437-\u0437\u0430 \u043d\u0435\u0445\u0432\u0430\u0442\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a:<\/p>\n<pre><code>yum install gcc gcc-c++ kernel-devel pcre-devel zlib-devel openssl-devel libxslt-devel install libgeoip-dev libgeoip-dev gd gd-devel perl-ExtUtils-Embed -y<\/code><\/pre>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c make modules (\u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a, \u0430 \u043d\u0435 make install, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0432\u0435\u0441\u044c Nginx).<\/p>\n<p>\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 <code>\/root\/nginx-1.14.1\/objs\/ngx_http_geoip2_module.so<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430\u0448 \u043c\u043e\u0434\u0443\u043b\u044c. <\/p>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e \u0432\u00a0 <code>\/usr\/share\/nginx\/modules\/<\/code> \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439   <code>cp ngx_http_geoip2_module.so \/usr\/share\/nginx\/modules\/ <\/code><\/p>\n<p>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435<\/p>\n<pre><code>\/etc\/nginx\/nginx.conf load_module modules\/ngx_http_geoip2_module.so;<\/code><\/pre>\n<p>\u0412 \u043f\u0430\u043f\u043a\u0443 <code>\/usr\/share\/GeoIP\/<\/code> \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0431\u0430\u0437\u0443 <code>GeoLite2-Country.mmdb<\/code>\u00a0<\/p>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 http \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c  <\/p>\n<pre><code>geoip2 \/usr\/share\/GeoIP\/GeoLite2-Country.mmdb {         $geoip2_data_country_iso_code country iso_code;         $geoip2_data_continent_code   continent code;     }    #\u0437\u0434\u0435\u0441\u044c \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0432\u0441\u0435\u043c, \u043a\u0440\u043e\u043c\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d     map $geoip2_data_country_iso_code $allowed_country {        default no;        RU yes;     }<\/code><\/pre>\n<p>\u041d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0438\u0442\u044c \u0441\u044e\u0434\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044e \u0431\u0430\u0437 Geo2Lite \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 MaxMind. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043e\u043d\u0430 \u043d\u0443\u0436\u043d\u0430, <a href=\"https:\/\/dev.maxmind.com\/geoip\/updating-databases\"><u>\u0432\u043e\u0442 \u0441\u0441\u044b\u043b\u043a\u0430<\/u><\/a>.<\/p>\n<p>\u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441\u0435\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0430\u0445 (\u043b\u0438\u0431\u043e \u0430\u0434\u0440\u0435\u0441\u0430).<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0442\u043e\u0442 \u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433 http<\/p>\n<pre><code>  geo $exclusions {          default 0;          123.123.123.123 1;  # \u0441\u044e\u0434\u0430 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u0442\u0438 \u043b\u0438\u0431\u043e \u0430\u0434\u0440\u0435\u0441\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f         12.13.11.0\/24 1;     }<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 server \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u00a0<\/p>\n<pre><code>if ($allowed_country = yes) {     set $exclusions 1; }  if ($exclusions = \"0\") {     return 403; }<\/code><\/pre>\n<p>\u041d\u0435 \u043f\u043e\u043c\u0435\u0448\u0430\u0435\u0442 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u043e\u0433\u0438 \u0441\u0442\u0440\u0430\u043d, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 <code>log_format\u00a0 main<\/code> \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c <code>$geoip2_data_country_iso_code<\/code><\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u0442\u0430\u043a\u043e\u0433\u043e:<\/p>\n<pre><code>log_format  main  '$remote_addr - $remote_user [$time_local] \"$request\" '                       '$status $body_bytes_sent \"$http_referer\" '                       '\"$http_user_agent\" \"$http_x_forwarded_for\"' \"$geoip2_data_country_iso_code\"; <\/code><\/pre>\n<p>\u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u043e\u0442\u0432\u0435\u0442\u0430 403<\/p>\n<pre><code>        error_page 403 @not_allowed;                 location @not_allowed {                  try_files \/my_403_error.html 403;        } <\/code><\/pre>\n<p>\u0438 \u0441\u0430\u043c\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 root location. \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e <code>\/usr\/share\/nginx\/html\/my_403_error.html<\/code>  <\/p>\n<details class=\"spoiler\">\n<summary>\u0421\u0430\u043c\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>&lt;h1>Oops, error 403. Access denied.&lt;\/h1> &lt;p>You do not have permission to access the page, let's try to solve this problem together:&lt;\/p> &lt;li>Let us know by mail: mail@domain.com and we will try to solve the problem together.&lt;\/li> &lt;\/ul> <\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0422\u0430\u043a\u0438\u043c \u043d\u0435\u0445\u0438\u0442\u0440\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u0441\u0430\u0439\u0442\u044b \u043e\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0443\u0433\u0440\u043e\u0437, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041d\u0430\u043c \u043f\u043e\u043c\u043e\u0433\u043b\u043e, \u0430\u0442\u0430\u043a\u0438 \u0441\u043e\u0448\u043b\u0438 \u043d\u0430 \u043d\u0435\u0442.  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/735932\/\"> https:\/\/habr.com\/ru\/articles\/735932\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-381069","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=381069"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/381069\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=381069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=381069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=381069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}