{"id":406807,"date":"2024-06-29T19:09:45","date_gmt":"2024-06-29T19:09:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=406807"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=406807","title":{"rendered":"<span>\u041e\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 \u043a\u043e\u0434\u0430: \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 nginx<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 <code>nginx<\/code>\u0443\u0447\u0430\u0441\u0442\u0438\u044f \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0439 \u043d\u0430\u0432\u044b\u043a \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0421\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 1\/10. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u0438\u0442 \u0438\u0434\u0435\u044f \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0438 \u0432\u0430\u043c \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0440\u0430\u0445 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. <a name=\"habracut\"><\/a><\/p>\n<p>  \u0418 \u0434\u0435\u043b\u043e \u043d\u0435 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0432\u0430\u043c \u0441\u0442\u043e\u0438\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u044f \u0432\u0438\u0436\u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u043e\u0441\u0435\u0449\u0430\u043b\u0430 \u0438\u0434\u0435\u044f \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u043c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0438\u043b\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. <\/p>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u0436\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u0440\u0435\u043b\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430\u0432\u044b\u043a\u043e\u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h2><font color=\"#3AC1EF\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a \u0438 \u0441\u0431\u043e\u0440\u043a\u0430<\/font><\/h2>\n<p>  \u041d\u0430 \u0432\u0435\u0440\u0445\u043d\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u044d\u0442\u0430\u043f\u044b \u0445\u0430\u043a\u0438\u043d\u0433\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b:  <\/p>\n<ol>\n<li>\u041d\u0430\u0439\u0442\u0438\/\u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434.<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\/\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b.<\/li>\n<li>\u041d\u0430\u0447\u0430\u0442\u044c \u0441 <code>grep<\/code>\u2019\u0438\u043d\u0433\u0430 \u0447\u0435\u0433\u043e-\u0442\u043e, \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u0432 \u0432\u044b\u0432\u043e\u0434\u0435, \u0438\u043b\u0438 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u0432\u0430\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/li>\n<li>\u0412\u043d\u0435\u0441\u0442\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u044e <code>.\/configure &amp;&amp; make<\/code> \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438.<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443.<\/li>\n<li>\u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u0448\u0430\u0433\u0443 4, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">nginx<\/font><\/h2>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0435\u043c \u0432\u0441\u0435 \u044d\u0442\u0438 \u0448\u0430\u0433\u0438 \u0434\u043b\u044f <code>nginx<\/code>. \u0427\u0435\u0440\u0435\u0437 \u043f\u043e\u0438\u0441\u043a \u0432 Google \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 <code>nginx github<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0434\u043e\u0441\u0443\u0442\u043f\u043d\u0443\u044e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0432\u0435\u0440\u0441\u0438\u044e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 <a href=\"https:\/\/github.com\/nginx\/nginx\">\u043d\u0430 GitHub<\/a>.<\/p>\n<pre><code class=\"cpp\">$ mkdir ~\/vendor $ cd ~\/vendor $ git clone https:\/\/github.com\/nginx\/nginx $ cd nginx<\/code><\/pre>\n<p>  \u041e\u0431\u043b\u043e\u043c, \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442 <code>readme<\/code>. \u0421\u043d\u043e\u0432\u0430 \u0438\u0434\u0435\u043c \u0432 Google, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c <code>nginx build from source<\/code>, \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u043c <a href=\"http:\/\/nginx.org\/en\/docs\/configure.html\">\u044d\u0442\u043e<\/a>.<\/p>\n<p>  \u0422\u0443\u0442 \u043c\u044b \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0435\u043c \u0442\u0438\u043f\u0438\u0447\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0421\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0432\u043f\u043e\u043b\u043d\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <code>.\/configure &amp;&amp; make<\/code>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0435 \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e\u0431\u044b \u0443 \u043d\u0435\u0433\u043e \u0431\u044b\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043a\u0440\u043e\u043c\u0435 \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430 \u0421\u0438.<\/p>\n<p>  \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c <code>autoconf<\/code>, <code>gmake <\/code>\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0421\u0438. \u0412 \u044d\u0442\u043e\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u043d\u0435\u0442 \u0444\u0430\u0439\u043b\u0430 <code>.\/configure<\/code>, \u043d\u043e \u0437\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u043e\u043d \u0435\u0441\u0442\u044c \u0432 <code>auto<\/code>. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c <code>cd auto &amp;&amp; .\/configure<\/code> \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0431\u0435\u0437\u0443\u0441\u043f\u0435\u0448\u043d\u043e, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c <code>.\/auto\/configure<\/code>. \u0412\u0440\u043e\u0434\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u043d\u043e \u0432\u044b\u0437\u0432\u0430\u043b\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"cpp\">$ .\/auto\/configure ... .\/auto\/configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=&lt;path> option.<\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>.\/auto\/configure --without-http_rewrite_module<\/code> \u0438 \u043f\u043e\u0442\u043e\u043c \u0435\u0449\u0435 \u0440\u0430\u0437, \u043a\u043e\u0433\u0434\u0430 \u043e\u043d\u0430 \u0434\u0430\u0435\u0442 \u0441\u0431\u043e\u0439, \u043d\u043e \u0443\u0436\u0435 \u0431\u0435\u0437 <code>http_gzip_module<\/code>.<\/p>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0430\u0432\u0442\u043e\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c Makefile. \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>make -j<\/code> \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0432\u0441\u0435\u0445 \u044f\u0434\u0435\u0440.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>git status<\/code>, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0430. \u0422\u0435\u043f\u0435\u0440\u044c <code>ls objs<\/code> \u0438\u2026 \u0432\u0443\u0430\u043b\u044f:<\/p>\n<pre><code class=\"cpp\">$ ls objs autoconf.err  nginx    ngx_auto_config.h   ngx_modules.c  src Makefile      nginx.8  ngx_auto_headers.h  ngx_modules.o<\/code><\/pre>\n<h2><font color=\"#3AC1EF\">\u0425\u0430\u043a<\/font><\/h2>\n<p>  \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 <code>dump<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u0432 \u0431\u043b\u043e\u043a\u0435 <code>location<\/code>. \u0427\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"cpp\">$ diff --git a\/conf\/nginx.conf b\/conf\/nginx.conf index 29bc085f..e96e817f 100644 --- a\/conf\/nginx.conf +++ b\/conf\/nginx.conf  @@ -41,8 +41,7 @@ http { #access_log  logs\/host.access.log  main;  location \/ { -            root   html; -            index  index.html index.htm; +            dump 'It was a good Thursday.';          }           #error_page  404              \/404.html; }<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c, \u0441\u043e\u0431\u0440\u0430\u0432 <code>nginx<\/code>, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u043b\u0430\u0433 <code>-t<\/code> \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\">$ .\/objs\/nginx -t -c $(pwd)\/conf\/nginx.conf nginx: [alert] could not open error log file: open() \"\/usr\/local\/nginx\/logs\/error.log\" failed (2: No such file or directory) 2021\/04\/04 21:24:09 [emerg] 1030951#0: unknown directive \"dump\" in \/home\/phil\/vendor\/nginx\/conf\/nginx.conf:44 nginx: configuration file \/home\/phil\/vendor\/nginx\/conf\/nginx.conf test failed<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0442 \u0447\u0435\u0433\u043e \u043e\u0442\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f! \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443, \u0438 \u044d\u0442\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 <code>grep<\/code>-\u0438\u043d\u0433\u0430:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep 'unknown directive' src\/core\/ngx_conf_file.c:                       \"unknown directive \\\"%s\\\"\", name->data);<\/code><\/pre>\n<p>  \u041a\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u044d\u0442\u043e\u0442 \u0441\u0431\u043e\u0439, \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 463: <code>rv = cmd->set(cf, cmd, conf)<\/code>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 <code>set<\/code>. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>git grep set<\/code> \u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043f\u043e\u043c\u043e\u0436\u0435\u0442. \u0422\u0430\u043a \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <code>cmd<\/code>, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0443\u044e <code>set<\/code>.<\/p>\n<p>  \u0410\u0433\u0430 \u2013 \u044d\u0442\u043e <code>ngx_command_t<\/code>. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0435\u0440\u0435\u0434 \u043d\u0435\u0439 \u043d\u0435\u0442 <code>struct<\/code>, \u044d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u043e\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>typedef <\/code>\u0438 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>;<\/code>. \u0418\u0442\u0430\u043a, <code>git grep ngx_command_t\\;<\/code> \u0434\u0430\u0435\u0442:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep ngx_command_t\\; src\/core\/ngx_core.h:typedef struct ngx_command_s         ngx_command_t;<\/code><\/pre>\n<p>  \u0418 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043a\u0440\u044b\u0442\u0430. \u0422\u043e\u0433\u0434\u0430 \u0438\u0449\u0435\u043c <code>ngx_command_s<\/code>:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep ngx_command_s src\/core\/ngx_conf_file.h:struct ngx_command_s { src\/core\/ngx_core.h:typedef struct ngx_command_s         ngx_command_t;<\/code><\/pre>\n<p>  \u041b\u0430\u0434\u043d\u043e, \u044d\u0442\u043e \u043d\u0438 \u043a \u0447\u0435\u043c\u0443 \u043d\u0435 \u0432\u0435\u0434\u0435\u0442. \u041c\u0435\u043d\u044f\u0435\u043c \u043f\u043e\u0434\u0445\u043e\u0434. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a\u0443\u044e \u0436\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043c\u044b \u0443\u0434\u0430\u043b\u0438\u043b\u0438.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff diff --git a\/conf\/nginx.conf b\/conf\/nginx.conf index 29bc085f..e96e817f 100644 --- a\/conf\/nginx.conf +++ b\/conf\/nginx.conf @@ -41,8 +41,7 @@ http {          #access_log  logs\/host.access.log  main;           location \/ { -            root   html; -            index  index.html index.htm; +            dump 'It was a good Thursday.';          }           #error_page  404              \/404.html;<\/code><\/pre>\n<p>  <code>root <\/code>\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep \\\"root\\\" docs\/xml\/nginx\/changes.xml:in the \"root\" or \"auth_basic_user_file\" directives. docs\/xml\/nginx\/changes.xml:a request was handled incorrectly, if a \"root\" directive used variables; docs\/xml\/nginx\/changes.xml:the $document_root variable usage in the \"root\" and \"alias\" directives docs\/xml\/nginx\/changes.xml:the $document_root variable did not support the variables in the \"root\" docs\/xml\/nginx\/changes.xml:if a \"root\" was specified by variable only, then the root was relative src\/http\/ngx_http_core_module.c:    { ngx_string(\"root\"), src\/http\/ngx_http_core_module.c:                           &amp;cmd->name, clcf->alias ? \"alias\" : \"root\");<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435. \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff src\/http\/ diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c             index 9b94b328..17a64e80 100644                                                            --- a\/src\/http\/ngx_http_core_module.c                                                      +++ b\/src\/http\/ngx_http_core_module.c                                                      @@ -331,6 +331,14 @@ static ngx_command_t  ngx_http_core_commands[] = {        0,        NULL }, +    { ngx_string(\"dump\"), +      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF +                        |NGX_CONF_TAKE1, +      ngx_http_core_dump, +      NGX_HTTP_LOC_CONF_OFFSET, +      0, +      NULL }, +      { ngx_string(\"alias\"),        NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,        ngx_http_core_root,<\/code><\/pre>\n<p>  \u042f\u0441\u043d\u043e. \u0417\u043d\u0430\u0447\u0438\u0442, \u0432\u043e\u0442 \u043a\u0430\u043a \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u0431\u043e\u0440\u043a\u0443 \u0431\u0435\u0437 <code>ngx_http_core_dump<\/code> \u043c\u044b \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c, \u0442\u0430\u043a \u0447\u0442\u043e \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u0435\u0435, \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0432\/\u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0432 <code>ngx_http_core_root<\/code>:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff src diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c index 9b94b328..c184dab5 100644 --- a\/src\/http\/ngx_http_core_module.c +++ b\/src\/http\/ngx_http_core_module.c @@ -4402,6 +4410,16 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) }   +static char * +ngx_http_core_dump(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ +    ngx_http_core_loc_conf_t *clcf = conf; +    ngx_str_t *value = cf->args->elts; +    clcf->dump = value[1]; +    return NGX_CONF_OK; +} + + static ngx_http_method_name_t  ngx_methods_names[] = {      { (u_char *) \"GET\",       (uint32_t) ~NGX_HTTP_GET },      { (u_char *) \"HEAD\",      (uint32_t) ~NGX_HTTP_HEAD },<\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0448\u0430 \u0446\u0435\u043b\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0434\u0430\u043c\u043f\u0430 \u0432 \u044d\u0442\u043e\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u0435 <code>conf<\/code>. \u0417\u0430\u0442\u0435\u043c \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043c\u044b \u0441\u043c\u043e\u0436\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d\u0430, \u0438 \u0435\u0441\u043b\u0438 \u0434\u0430, \u0442\u043e \u043e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u0437\u0430\u043f\u0440\u043e\u0441 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u043e\u0439.<\/p>\n<p>  \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 \u043d\u0435 \u0441\u043e\u0431\u0435\u0440\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442 <code>conf<\/code>. \u041d\u043e <code>make <\/code>\u043c\u044b \u0432\u0441\u0435 \u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c:<\/p>\n<pre><code class=\"cpp\">$ make -f objs\/Makefile make[1]: Entering directory '\/home\/phil\/vendor\/nginx' cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src\/core -I src\/event -I src\/event\/modules -I src\/os\/unix -I objs -I src\/http -I src\/http\/modules \\         -o objs\/src\/http\/ngx_http_core_module.o \\         src\/http\/ngx_http_core_module.c src\/http\/ngx_http_core_module.c:337:7: error: ngx_http_core_dump undeclared here (not in a function); did you mean ngx_http_core_type? 337 |       ngx_http_core_dump,     |       ^~~~~~~~~~~~~~~~~~~~~     |       ngx_http_core_type src\/http\/ngx_http_core_module.c: In function ngx_http_core_dump: src\/http\/ngx_http_core_module.c:4418:9: error: ngx_http_core_loc_conf_t {aka struct ngx_http_core_loc_conf_s} has no member named dump 4418 |     clcf->dump = value[1];      |         ^~ src\/http\/ngx_http_core_module.c:4418:5: error: statement with no effect [-Werror=unused-value] 4418 |     clcf->dump = value[1];      |     ^~~~ At top level: src\/http\/ngx_http_core_module.c:4414:1: error: ngx_http_core_dump defined but not used [-Werror=unused-function] 4414 | ngx_http_core_dump(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)      | ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [objs\/Makefile:834: objs\/src\/http\/ngx_http_core_module.o] Error 1 make[1]: Leaving directory '\/home\/phil\/vendor\/nginx' make: *** [Makefile:10: build] Error 2<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0434\u0430\u043c\u043f\u0430 \u043d\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d. \u041a\u043e\u0433\u0434\u0430 \u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043b <code>ngx_http_core_root<\/code>, \u0442\u043e \u0432\u044b\u0448\u0435 \u0432\u0438\u0434\u0435\u043b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043b\u0438.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c index 9b94b328..430e1256 100644 --- a\/src\/http\/ngx_http_core_module.c +++ b\/src\/http\/ngx_http_core_module.c @@ -56,6 +56,7 @@ static char *ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, static char *ngx_http_core_server_name(ngx_conf_t *cf, ngx_command_t *cmd,     void *conf); static char *ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +static char *ngx_http_core_dump(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);  static char *ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd,     void *conf);  static char *ngx_http_core_set_aio(ngx_conf_t *cf, ngx_command_t *cmd,<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0431\u043e\u0440\u043a\u0430:<\/p>\n<pre><code class=\"cpp\">$ make make -f objs\/Makefile make[1]: Entering directory '\/home\/phil\/vendor\/nginx' cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src\/core -I src\/event -I src\/event\/modules -I src\/os\/unix -I objs -I src\/http -I src\/http\/modules \\         -o objs\/src\/http\/ngx_http_core_module.o \\ src\/http\/ngx_http_core_module.c src\/http\/ngx_http_core_module.c: In function ngx_http_core_dump: src\/http\/ngx_http_core_module.c:4419:9: error: ngx_http_core_loc_conf_t {aka struct ngx_http_core_loc_conf_s} has no member named dump 4419 |     clcf->dump = value[1];      |         ^~ make[1]: *** [objs\/Makefile:834: objs\/src\/http\/ngx_http_core_module.o] Error 1 make[1]: Leaving directory '\/home\/phil\/vendor\/nginx' make: *** [Makefile:10: build] Error 2<\/code><\/pre>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c <code>dump <\/code>\u0432 \u044d\u0442\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 <code>conf<\/code>.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep ngx_http_core_loc_conf_t\\; src\/http\/ngx_http_core_module.h:typedef struct ngx_http_core_loc_conf_s  ngx_http_core_loc_conf_t;<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c <code>root<\/code>:<\/p>\n<pre><code class=\"cpp\">$ diff --git a\/src\/http\/ngx_http_core_module.h b\/src\/http\/ngx_http_core_module.h index 2aadae7f..6b1b178b 100644 --- a\/src\/http\/ngx_http_core_module.h +++ b\/src\/http\/ngx_http_core_module.h @@ -333,6 +333,7 @@ struct ngx_http_core_loc_conf_s { \/* location name length for inclusive location with inherited alias *\/      size_t        alias;      ngx_str_t     root;                    \/* root, alias *\/ +    ngx_str_t     dump;      ngx_str_t     post_action;       ngx_array_t  *root_lengths;<\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>make<\/code>, \u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e!<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u043e\u0432 \u0437\u0430 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u0443\u0434\u0430\u0447\u043d\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u0443\u043a\u0430 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430.<\/p>\n<p>  \u0412 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u043d\u0430 \u0440\u043e\u043b\u044c \u0442\u0430\u043a\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430, \u043f\u043e\u0445\u043e\u0436\u0435, \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 <code>ngx_http_core_find_config_phase<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 <code>dump<\/code>.<\/p>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u0432\u0435\u0442. \u041f\u043e\u0438\u0441\u043a <code>response <\/code>\u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>grep <\/code>\u0437\u0434\u0435\u0441\u044c \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u043f\u043e\u043c\u043e\u0436\u0435\u0442, \u043a\u0430\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>write<\/code>. \u041e\u0434\u043d\u0430\u043a\u043e <code>send <\/code>\u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c, \u043d\u043e \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u043c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager grep send\\( src\/mail\/ngx_mail.h:void ngx_mail_send(ngx_event_t *wev); src\/mail\/ngx_mail_auth_http_module.c:    n = ngx_send(c, ctx->request->pos, size);) ...<\/code><\/pre>\n<p>  \u0412\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0431\u0435\u0449\u0430\u044e\u0449\u0435. \u0421\u0443\u0434\u044f \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0444\u0430\u0439\u043b\u0443, \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 <code>->data<\/code>. \u0420\u0430\u043d\u0435\u0435 \u0432 <code>src\/http\/ngx_http_core_module.c<\/code> \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442: <code>r->connection->write->data<\/code>. \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0435\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 <code>ngx_send<\/code> \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0434\u043b\u0438\u043d\u0443.<\/p>\n<p>  \u0425\u043e\u0440\u043e\u0448\u043e. \u042d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0438\u0437 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 <code>dump<\/code>, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c index 9b94b328..bd58788b 100644 --- a\/src\/http\/ngx_http_core_module.c +++ b\/src\/http\/ngx_http_core_module.c @@ -989,6 +996,11 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,          ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);          return NGX_OK; } + +    if (clcf->dump.len) { +      ngx_send(r->connection->write->data, clcf->dump.data, clcf->dump.len); +      return NGX_OK; +    }<\/code><\/pre>\n<p>  \u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>make<\/code>, \u0438 \u0432\u0441\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e! \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u043c \u0434\u0435\u043c\u043e\u043d\u0430 <code>nginx <\/code>\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0432\u043e\u0440\u043a\u0435\u0440\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0432\u044b\u0445\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043d\u0430\u0448\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432.<\/p>\n<pre><code class=\"bash\">$ git --no-pager diff conf\/ diff --git a\/conf\/nginx.conf b\/conf\/nginx.conf index 29bc085f..7cce7d65 100644 --- a\/conf\/nginx.conf +++ b\/conf\/nginx.conf @@ -1,4 +1,5 @@ - +daemon off; +master_process off;  #user  nobody;  worker_processes  1;<\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>.\/objs\/nginx -c $(pwd)\/conf\/nginx.conf<\/code>. \u041f\u0440\u043e\u0431\u0443\u0435\u043c <code>curl<\/code>:<\/p>\n<pre><code class=\"cpp\">$ curl localhost:2020 curl: (1) Received HTTP\/0.9 when not allowed<\/code><\/pre>\n<p>  \u0410 \u0432\u043e\u0442 \u044d\u0442\u043e \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u043d\u043d\u043e. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>telnet<\/code>:<\/p>\n<pre><code class=\"cpp\">$ telnet localhost 2020 Trying ::1... telnet: connect to address ::1: Connection refused Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET \/ It was a good Thursday.<\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u044d\u0442\u043e \u0434\u0430. \u0421\u0443\u043f\u0435\u0440 \u043a\u0440\u0443\u0442\u043e! \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u043d\u0435 \u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0439 HTTP. \u041f\u043e\u0445\u043e\u0436\u0435, \u0435\u0441\u043b\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>ngx_send<\/code>, \u0442\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 HTTP-\u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043c\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0432 <code>ngx_send<\/code> \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 <code>ngx_str_t<\/code>. \u0421\u0443\u0434\u044f \u043f\u043e <code>src\/core\/ngx_string.h<\/code>, \u0441 \u044d\u0442\u0438\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043c\u0430\u043a\u0440\u043e\u0441 <code>ngx_string<\/code>.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff src diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c index 9b94b328..1a1baccd 100644 --- a\/src\/http\/ngx_http_core_module.c +++ b\/src\/http\/ngx_http_core_module.c @@ -989,6 +996,13 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,          ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);          return NGX_OK;      } + +    static ngx_str_t header = ngx_string(\"HTTP\/1.0 200 OK\\r\\n\\r\\n\"); +    if (clcf->dump.len) { +      ngx_send(r->connection->write->data, header.data, header.len); +      ngx_send(r->connection->write->data, clcf->dump.data, clcf->dump.len); +      return NGX_OK; +    }       if (rc == NGX_DONE) {          ngx_http_clear_location(r); }<\/code><\/pre>\n<p>  \u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>curl<\/code>:<\/p>\n<pre><code class=\"cpp\">$ curl localhost:2020<\/code><\/pre>\n<p>  \u041c\u0434\u0430. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0440\u0443\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 <code>HTTP\/0.9<\/code>, \u0437\u0430\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u0437\u0430\u0432\u0438\u0441\u0430\u0435\u0442. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>curl<\/code>:<\/p>\n<pre><code class=\"cpp\">$ curl -vvv localhost:2020 *   Trying ::1:2020... * connect to ::1 port 2020 failed: Connection refused *   Trying 127.0.0.1:2020... * Connected to localhost (127.0.0.1) port 2020 (#0) > GET \/ HTTP\/1.1 > Host: localhost:2020 > User-Agent: curl\/7.71.1 > Accept: *\/* > * Mark bundle as not supporting multiuse * HTTP 1.0, assume close after body &lt; HTTP\/1.0 200 OK<\/code><\/pre>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u041d\u043e \u044f \u0437\u0430\u043c\u0435\u0442\u0438\u043b \u0442\u0430\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <code>ngx_http_request_finalize<\/code>, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u0443\u044e \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0443\u0447\u0430\u0441\u0442\u043a\u043e\u0432 \u043a\u043e\u0434\u0430. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">$ git --no-pager diff src diff --git a\/src\/http\/ngx_http_core_module.c b\/src\/http\/ngx_http_core_module.c index 9b94b328..1a1baccd 100644 --- a\/src\/http\/ngx_http_core_module.c +++ b\/src\/http\/ngx_http_core_module.c @@ -989,6 +996,14 @@ ngx_http_core_find_config_phase(ngx_http_request_t *r,          ngx_http_finalize_request(r, NGX_HTTP_REQUEST_ENTITY_TOO_LARGE);          return NGX_OK;      } + +    static ngx_str_t header = ngx_string(\"HTTP\/1.0 200 OK\\r\\n\\r\\n\"); +    if (clcf->dump.len) { +      ngx_send(r->connection->write->data, header.data, header.len); +      ngx_send(r->connection->write->data, clcf->dump.data, clcf->dump.len); +      ngx_http_finalize_request(r, NGX_DONE); +      return NGX_OK; +    }<\/code><\/pre>\n<p>  \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c <code>curl<\/code>. \u041e\u043f\u044f\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0430\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 <code>ngx_http_finalize_request<\/code>, \u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e \u0442\u0430\u043c \u0435\u0441\u0442\u044c \u043a\u0435\u0439\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 <code>NGX_HTTP_CLOSE<\/code>. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0435\u0433\u043e.<\/p>\n<pre><code class=\"cpp\">$ curl localhost:2020 It was a good Thursday.<\/code><\/pre>\n<p>  \u041d\u0443 \u0432\u043e\u0442. \u0421\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e.<\/p>\n<h2><font color=\"#3AC1EF\">\u0427\u0442\u043e \u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043d\u044f\u043b<\/font><\/h2>\n<p>  \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043b\u0438 \u044d\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 <code>nginx<\/code>? \u041d\u0435\u0442. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u044f \u043a\u043e\u0435-\u0447\u0442\u043e \u0437\u043d\u0430\u043b \u043e \u043c\u043e\u0434\u0443\u043b\u044f\u0445 <code>nginx <\/code>\u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u044d\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u043a\u0430\u043a \u0438 \u043c\u043e\u0434\u0443\u043b\u044c, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u0435\u0435.<\/p>\n<p>  \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0432\u044b\u0441\u043e\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0435 \u043e\u0442\u0432\u0435\u0442\u044b, \u0430 \u043d\u0435 \u0432\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=Bright_Translate&amp;utm_content=osvaivaem_novuyu_bazu_koda:_revers-inzhiniring_nginx\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\" data-src=\"https:\/\/habrastorage.org\/webt\/ou\/g5\/kh\/oug5kh6sjydt9llengsiebnp40w.png\"\/><\/a><\/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\/575574\/\"> https:\/\/habr.com\/ru\/articles\/575574\/<\/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-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\u0412 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 <code>nginx<\/code>\u0443\u0447\u0430\u0441\u0442\u0438\u044f \u044f \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043e\u0439 \u043d\u0430\u0432\u044b\u043a \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0421\u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 1\/10. \u041e\u0434\u043d\u0430\u043a\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u0441\u0442\u0440\u0430\u0448\u0438\u0442 \u0438\u0434\u0435\u044f \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434, \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e, \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u0426\u0435\u043b\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u043c\u043e\u0447\u044c \u0438 \u0432\u0430\u043c \u043f\u0440\u0435\u043e\u0434\u043e\u043b\u0435\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u0442\u0440\u0430\u0445 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435. <\/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-406807","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406807","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=406807"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/406807\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=406807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=406807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=406807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}