{"id":929,"date":"2026-09-17T23:46:40","date_gmt":"2026-09-17T20:46:40","guid":{"rendered":"https:\/\/imaxis.ru\/?p=929"},"modified":"2026-09-18T00:05:57","modified_gmt":"2026-09-17T21:05:57","slug":"nastroyka-nginx-dlya-http-2-po-shagam","status":"publish","type":"post","link":"https:\/\/imaxis.ru\/?p=929","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 NGINX \u0434\u043b\u044f HTTP\/2 \u043f\u043e \u0448\u0430\u0433\u0430\u043c"},"content":{"rendered":"<h1>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 NGINX \u0434\u043b\u044f HTTP\/2 \u043f\u043e \u0448\u0430\u0433\u0430\u043c<\/h1>\n<p>HTTP\/2 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e HTTPS \u2014 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0435\u0433\u043e \u0431\u0435\u0437 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u043e \u0448\u0430\u0433\u0430\u043c: \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 NGINX \u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430.<\/p>\n<p>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u043e\u0434\u043e\u0439\u0434\u0451\u0442 \u0434\u043b\u044f Ubuntu\/Debian (\u0437\u0430\u043c\u0435\u043d\u0430 <code>yum<\/code> \u043d\u0430 <code>apt<\/code>) \u0438 RPM-\u0441\u0438\u0441\u0442\u0435\u043c.<\/p>\n<hr \/>\n<h2>\u0428\u0430\u0433 1. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u043b\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 NGINX<\/h2>\n<p>HTTP\/2 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 NGINX <strong>1.9.5<\/strong> (\u043c\u043e\u0434\u0443\u043b\u044c <code>ngx_http_v2_module<\/code>).<\/p>\n<p><strong>\u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435:<\/strong><\/p>\n<pre><code class=\"language-bash\">nginx -v\napt update &amp;&amp; apt install --only-upgrade nginx    # DEB\ndnf update nginx                                  # RPM\n<\/code><\/pre>\n<p><strong>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f (RPM):<\/strong><\/p>\n<pre><code class=\"language-bash\">vi \/etc\/yum.repos.d\/nginx.repo\n<\/code><\/pre>\n<pre><code class=\"language-ini\">[nginx]\nname=nginx repo\nbaseurl=http:\/\/nginx.org\/packages\/centos\/$releasever\/$basearch\/\ngpgcheck=0\nenabled=1\n<\/code><\/pre>\n<pre><code class=\"language-bash\">yum update\nyum install nginx\n<\/code><\/pre>\n<p><strong>\u0412 Ubuntu\/Debian \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 NGINX (1.25+) \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u043d \u0441 HTTP\/2.<\/strong><\/p>\n<hr \/>\n<h2>\u0428\u0430\u0433 2. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 OpenSSL<\/h2>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c, \u0441 \u043a\u0430\u043a\u043e\u0439 OpenSSL \u0441\u043e\u0431\u0440\u0430\u043d NGINX:<\/p>\n<pre><code class=\"language-bash\">nginx -V\n<\/code><\/pre>\n<pre><code>built with OpenSSL 3.x ...\n<\/code><\/pre>\n<p><strong>\u0412\u0435\u0440\u0441\u0438\u044f OpenSSL \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0435 \u043d\u0438\u0436\u0435 1.0.2 \u2014 \u0434\u043b\u044f \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e TLS \u043e\u0431\u044b\u0447\u043d\u043e \u0443\u0436\u0435 3.x.<\/strong><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0435\u0440\u0441\u0438\u044f \u0441\u0442\u0430\u0440\u0430\u044f, \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c NGINX:<\/p>\n<pre><code class=\"language-bash\">wget http:\/\/nginx.org\/download\/nginx-1.31.6.tar.gz\ntar -xvf nginx-*.tar.gz\ncd nginx-*\napt install build-essential libpcre3-dev zlib1g-dev libssl-dev libxml2-dev libxslt1-dev libgd-dev libgeoip-dev libperl-dev   # DEB\n<\/code><\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b <code>configure<\/code> \u0438\u0437 \u0432\u044b\u0432\u043e\u0434\u0430 <code>nginx -V<\/code> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0443\u0431\u0435\u0434\u0438\u0432\u0448\u0438\u0441\u044c \u0432 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 <code>--with-http_v2_module<\/code>:<\/p>\n<pre><code class=\"language-bash\">.\/configure &lt;\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438\u0437 nginx -V&gt; --with-http_v2_module\nmake\nmake install\n<\/code><\/pre>\n<p><strong>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 NGINX 1.25.1 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0430 <code>listen 443 ssl http2<\/code> \u0443\u0441\u0442\u0430\u0440\u0435\u043b\u0430 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f <code>http2 on;<\/code>.<\/strong><\/p>\n<hr \/>\n<h2>\u0428\u0430\u0433 3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u0430<\/h2>\n<p>HTTP\/2 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442 HTTPS. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u2014 \u0441\u0430\u043c\u043e\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442; \u0434\u043b\u044f \u043f\u0440\u043e\u0434\u0430 \u2014 Let&#8217;s Encrypt \u0438\u043b\u0438 \u043a\u043e\u043c\u043c\u0435\u0440\u0447\u0435\u0441\u043a\u0438\u0439 CA.<\/p>\n<pre><code class=\"language-bash\">mkdir \/etc\/nginx\/ssl\nopenssl req -new -x509 -days 1461 -nodes -out \/etc\/nginx\/ssl\/cert.pem -keyout \/etc\/nginx\/ssl\/cert.key \n  -subj &quot;\/C=RU\/ST=SPb\/L=SPb\/O=Global Security\/OU=IT Department\/CN=test.dmosk.local\/CN=test&quot;\n<\/code><\/pre>\n<p><strong>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u043d\u0430 4 \u0433\u043e\u0434\u0430 (1461 \u0434\u0435\u043d\u044c) \u0434\u043b\u044f <code>test.dmosk.local<\/code>\/<code>test<\/code>.<\/strong><\/p>\n<hr \/>\n<h2>\u0428\u0430\u0433 4. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 NGINX<\/h2>\n<pre><code class=\"language-bash\">vi \/etc\/nginx\/conf.d\/test.dmosk.local.conf\n<\/code><\/pre>\n<pre><code class=\"language-nginx\">server {\n    listen 80;\n    server_name test-http2.dmosk.local;\n    return 301 https:\/\/$host$request_uri;\n}\n\nserver {\n    listen 443 ssl;\n    http2 on;\n\n    ssl_certificate \/etc\/nginx\/ssl\/cert.pem;\n    ssl_certificate_key \/etc\/nginx\/ssl\/cert.key;\n\n    location \/ {\n        root \/usr\/share\/nginx\/html;\n    }\n}\n<\/code><\/pre>\n<p><strong>\u041f\u0435\u0440\u0432\u044b\u0435 4 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 HTTP \u043d\u0430 HTTPS; <code>\/etc\/nginx\/ssl\/<\/code> \u2014 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0432; <code>\/usr\/share\/nginx\/html<\/code> \u2014 \u043a\u043e\u0440\u0435\u043d\u044c \u0441\u0430\u0439\u0442\u0430.<\/strong><\/p>\n<p><strong>\u0421\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/strong> <code>http2 on;<\/code> \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u043e\u0439 \u0432\u043c\u0435\u0441\u0442\u043e \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0433\u043e <code>listen 443 ssl http2;<\/code>.<\/p>\n<pre><code class=\"language-bash\">nginx -t &amp;&amp; nginx -s reload\n<\/code><\/pre>\n<hr \/>\n<h2>\u0428\u0430\u0433 5. \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 HTTP\/2<\/h2>\n<ul>\n<li><strong>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0440\u0435\u0441\u0443\u0440\u0441:<\/strong> \u043e\u043d\u043b\u0430\u0439\u043d-\u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/geekflare.com\/tools\/http2-test\">geekflare.com\/tools\/http2-test<\/a>.<\/li>\n<li><strong>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u043e:<\/strong> \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f Chrome \u2014 HTTP\/2 indicator) \u0438\u043b\u0438:<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">curl -I --http2 -k https:\/\/test-http2.dmosk.local\n<\/code><\/pre>\n<pre><code>HTTP\/2 200\n<\/code><\/pre>\n<p><strong>\u0421\u0442\u0440\u043e\u043a\u0430 <code>HTTP\/2 200<\/code> \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430.<\/strong><\/p>\n<hr \/>\n<h2>\u0422\u043e\u043d\u043a\u043e\u0441\u0442\u0438 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0435 \u043a\u0430\u043c\u043d\u0438<\/h2>\n<ul>\n<li><strong>HTTP\/2 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e HTTPS<\/strong> \u2014 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u044b \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 h2c (\u043d\u0435\u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 HTTP\/2).<\/li>\n<li><strong><code>http2 on;<\/code><\/strong> \u2014 \u0432 NGINX 1.25.1+ \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>http2<\/code> \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0435 <code>listen<\/code> \u0443\u0441\u0442\u0430\u0440\u0435\u043b.<\/li>\n<li><strong><code>--with-http_v2_module<\/code><\/strong> \u2014 \u043f\u0440\u0438 \u0440\u0443\u0447\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f.<\/li>\n<li><strong>OpenSSL<\/strong> \u2014 \u0441\u0442\u0430\u0440\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0448\u0438\u0444\u0440\u044b \u0438 ALPN (\u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u0438\u044f HTTP\/2).<\/li>\n<li><strong><code>nginx -t<\/code> \u043f\u0435\u0440\u0435\u0434 reload<\/strong> \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439\u0442\u0435 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/li>\n<li><strong>\u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442<\/strong> \u2014 \u0441\u0430\u043c\u043e\u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430, \u043d\u043e HTTP\/2 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/li>\n<li><strong>HTTP\/3<\/strong> \u2014 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 NGINX \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 QUIC (<code>listen 443 quic reuseport;<\/code> + <code>http3 on;<\/code>), \u043d\u043e \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0442\u0435\u043c\u0430.<\/li>\n<\/ul>\n<hr \/>\n<h2>\u0428\u043f\u0430\u0440\u0433\u0430\u043b\u043a\u0430<\/h2>\n<pre><code class=\"language-bash\">nginx -v          # &gt;= 1.9.5\nnginx -V          # \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c OpenSSL \u0438 --with-http_v2_module\n\nmkdir -p \/etc\/nginx\/ssl\nopenssl req -new -x509 -days 1461 -nodes -out \/etc\/nginx\/ssl\/cert.pem -keyout \/etc\/nginx\/ssl\/cert.key -subj &quot;\/CN=test.local&quot;\n\n# server { listen 443 ssl; http2 on; ssl_certificate ...; }\nnginx -t &amp;&amp; nginx -s reload\ncurl -I --http2 -k https:\/\/test.local    # HTTP\/2 200\n<\/code><\/pre>\n<p><em>\u041f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043d\u0430: Ubuntu 22.04\/24.04, Rocky Linux 9 + NGINX 1.31.6.<\/em><br \/>\n<em>\u0414\u0430\u0442\u0430: \u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c 2026.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 NGINX \u0434\u043b\u044f HTTP\/2 \u043f\u043e \u0448\u0430\u0433\u0430\u043c HTTP\/2 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430\u0445<\/p>\n","protected":false},"author":0,"featured_media":970,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-929","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"views":15,"_links":{"self":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=929"}],"version-history":[{"count":2,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/929\/revisions"}],"predecessor-version":[{"id":932,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/posts\/929\/revisions\/932"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=\/wp\/v2\/media\/970"}],"wp:attachment":[{"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/imaxis.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}