{"id":306237,"date":"2020-07-01T15:00:09","date_gmt":"2020-07-01T15:00:09","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=306237"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=306237","title":{"rendered":"\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 web \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (Nginx + Apache2)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509122\/\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0432\u0443\u0445 web-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0441 \u0446\u0435\u043b\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445, \u0433\u0434\u0435 Nginx \u2014 \u043a\u0430\u043a frontend \u0438 Apache \u2014 \u043a\u0430\u043a backend.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445: <strong>Apache2, Nginx, ngx_pagespeed, PHP, PHP-FPM, MariaDB \u0438 MemCached<\/strong>.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"nginx\">Nginx<\/h2>\n<p>  <\/p>\n<p>HTTP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440, \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440, \u0430 \u0442\u0430\u043a\u0436\u0435 TCP\/UDP \u043f\u0440\u043e\u043a\u0441\u0438-\u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0431\u0449\u0435\u0433\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0435 \u043f\u0430\u043a\u0435\u0442\u044b, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f apt-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">sudo apt install curl gnupg2 ca-certificates lsb-release<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f apt-\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 nginx, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">echo &quot;deb http:\/\/nginx.org\/packages\/debian `lsb_release -cs` nginx&quot; \\     | sudo tee \/etc\/apt\/sources.list.d\/nginx.list<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 apt \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u043e\u0434\u043b\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">curl -fsSL https:\/\/nginx.org\/keys\/nginx_signing.key | sudo apt-key add -<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044c\u0442\u0435, \u0432\u0435\u0440\u043d\u044b\u0439 \u043b\u0438 \u043a\u043b\u044e\u0447 \u0431\u044b\u043b \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">sudo apt-key fingerprint ABF5BD827BD9BF62<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0432\u043e\u0434 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0442\u043f\u0435\u0447\u0430\u0442\u043e\u043a \u043a\u043b\u044e\u0447\u0430 <code>573B FD6B 3D8F BC64 1079 A6AB ABF5 BD82 7BD9 BF62<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">pub   rsa2048 2011-08-19 [SC] [expires: 2024-06-14]       573B FD6B 3D8F BC64 1079  A6AB ABF5 BD82 7BD9 BF62 uid   [ unknown] nginx signing key<\/code><\/pre>\n<p>  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c nginx, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">sudo apt update &amp;&amp; sudo apt install nginx<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c nginx<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl enable nginx &amp;&amp; systemctl start nginx<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c nginx <code>user www-data<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/nginx\/nginx.conf<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 <a href=\"http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441\">http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441<\/a> \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u00bb.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u00abWelcome to nginx!\u00bb.<\/p>\n<p>  <\/p>\n<h2 id=\"php-fpm\">PHP-FPM<\/h2>\n<p>  <\/p>\n<p>FastCGI \u2014 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u043c\u0438. FPM \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a Fastcgi Process Manager.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-1\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c PHP-FPM:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apt-get install php-fpm<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-1\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a php-fpm \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0435\u0433\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl enable php7.3-fpm &amp;&amp; systemctl start php7.3-fpm<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 php-fpm \u0432\u0435\u0440\u0441\u0438\u0438 7.2. \u041d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 \u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e \u0432\u0435\u0440\u0441\u0438\u0438 php \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 php -v.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"ngx_pagespeed\">ngx_pagespeed<\/h2>\n<p>  <\/p>\n<p><strong>ngx_pagespeed<\/strong> (\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e pagespeed) \u2013 \u044d\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c Nginx, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0430\u0439\u0442\u0430 \u043f\u0443\u0442\u0451\u043c \u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0441\u0430\u0439\u0442\u0430 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435. \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043c\u043e\u0434\u0443\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0430\u0439\u0442\u0435.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-2\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">sudo apt-get install unzip gcc make g++ libpcre3-dev zlib1g-dev build-essential libpcre3 uuid-dev<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-2\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c <code>ngx_pagespeed<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mkdir \/etc\/nginx\/build cd \/etc\/nginx\/build<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0437\u043d\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e nginx:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nginx -v<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">wget -qO - http:\/\/nginx.org\/download\/nginx-1.18.0.tar.gz | tar zxfv -<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e nginx 1.18<\/em><\/p>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 <code>ngx_pagespeed<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">git clone https:\/\/github.com\/pagespeed\/ngx_pagespeed.git  cd ngx_pagespeed\/  git checkout tags\/latest-stable  cat PSOL_BINARY_URL<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 psol:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">psol_url=https:\/\/dl.google.com\/dl\/page-speed\/psol\/${NPS_VERSION}.tar.gz [ -e scripts\/format_binary_url.sh ] &amp;&amp; psol_url=$(scripts\/format_binary_url.sh PSOL_BINARY_URL)  wget ${psol_url} tar zxf 1.13.35.2-x64.tar.gz<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0444\u0430\u0439\u043b <code>ngx_pagespeed.so<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">cd ..\/nginx-1.18.0\/  .\/configure --add-dynamic-module=..\/ngx_pagespeed --with-compat  make  ls objs\/*so<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b <code>ngx_pagespeed.so<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">cd objs cp ngx_pagespeed.so \/etc\/nginx\/modules<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"apache2\">Apache2<\/h2>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0444\u0430\u0439\u043b\u0430 .htaccess, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043d\u043e\u0433\u0438\u043c\u0438 \u0441\u0430\u0439\u0442\u0430\u043c\u0438, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 Apache.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-3\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c apache \u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f php:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apt-get install apache2 libapache2-mod-php<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-3\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u0440\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/apache2\/ports.conf<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">Listen 127.0.0.1:8080  # &lt;IfModule ssl_module&gt; #    Listen 443 # &lt;\/IfModule&gt;  # &lt;IfModule mod_gnutls.c&gt; #    Listen 443 # &lt;\/IfModule&gt;<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u043c\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8080, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0430 80 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 NGINX. \u0422\u0430\u043a\u0436\u0435 \u043c\u044b \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043f\u0440\u043e\u0441\u043b\u0443\u0448\u0438\u0432\u0430\u043d\u0438\u0435 \u043f\u043e 443, \u0442\u0430\u043a \u043a\u0430\u043a \u0438 \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c\u0441\u044f NGINX.<\/em><\/p>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c mpm_event:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2dismod mpm_event<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, apache2 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0441 \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 mpm_event. \u0414\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 php 7 \u0438 \u0432\u044b\u0448\u0435.<\/em><\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 <code>mpm_prefork<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2enmod mpm_prefork<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>php<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2enmod php7.3<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>rewrite<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2enmod rewrite<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c <code>setenvif<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2enmod setenvif<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl enable apache2 &amp;&amp; systemctl start apache2<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 <a href=\"http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441\">http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441<\/a> \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u00bb:8080. \u041c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u0443\u044e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443.<\/p>\n<p>  <\/p>\n<p><em>\u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Server API \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c Apache.<\/em><\/p>\n<p>  <\/p>\n<h2 id=\"apache2-real-ip\">Apache2 Real IP<\/h2>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 apache \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043e\u0442 NGINX, \u0438 \u043e\u043d\u0438 \u0432\u043e\u0441\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c \u043a\u0430\u043a \u043e\u0442 IP-\u0430\u0434\u0440\u0435\u0441\u0430 127.0.0.1. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0441\u0430\u0439\u0442\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u0434\u0440\u0435\u0441\u0430 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c remoteip.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-4\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/apache2\/mods-available\/remoteip.conf<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-4\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&lt;IfModule remoteip_module&gt;   RemoteIPHeader X-Forwarded-For   RemoteIPTrustedProxy 127.0.0.1\/8 &lt;\/IfModule&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410\u043a\u0442\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">a2enmod remoteip<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c apache:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl restart apache2<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u0432\u0432\u043e\u0434\u0438\u043c \u0432 \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 <a href=\"http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441\">http:\/\/\u00abIP-\u0430\u0434\u0440\u0435\u0441<\/a> \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u00bb, \u0433\u0434\u0435 \u043e\u0442\u043a\u0440\u043e\u0435\u0442\u0441\u044f \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 phpinfo.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 Apache Environment \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0430\u0434\u0440\u0435\u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u043c\u0441\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0432 \u043e\u043f\u0446\u0438\u0438 REMOTE_ADDR.<\/p>\n<p>  <\/p>\n<h2 id=\"php\">PHP<\/h2>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f PHP \u0438 PHP-FPM:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apt install php-xml php-intl php-gd php-curl php-zip php-mbstring php-bcmath php-bz2 php-cgi php-cli php-common php-dba php-dev php-enchant php-gmp php-imap php-interbase php-json php-ldap php-odbc php-opcache php-phpdbg php-pspell php-readline php-recode php-sybase php-tidy php-xmlrpc php-xsl<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"mysql-mariadb\">Mysql (Mariadb)<\/h2>\n<p>  <\/p>\n<h3 id=\"ustanovka-5\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c MariaDB:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apt-get install mariadb-server php-mysql php-mysqli<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-5\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0421\u0423\u0411\u0414:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl enable mariadb systemctl start mariadb<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0434\u0438\u043c \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mysqladmin -u root password<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c apache2:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl restart apache2<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mysql -uroot -p  mysql&gt; GRANT ALL PRIVILEGES ON *.* TO 'dbuser'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;  # ALL PRIVILEGES: \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. # *.* : \u043f\u0440\u0430\u0432\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0441\u0435 \u0431\u0430\u0437\u044b \u0438 \u0432\u0441\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. # dbuser: \u0438\u043c\u044f \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. # localhost: \u0434\u043e\u0441\u0442\u0443\u043f \u0434\u043b\u044f \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430. # password: \u043f\u0430\u0440\u043e\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u0434\u0430\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. # WITH GRANT OPTION: \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0431\u0430\u0437 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446.<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0445\u043e\u0434\u0430 \u0432 adminer.php<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&gt; update user set plugin='' where User='root';  &gt; flush privileges;  &gt; exit<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">sudo systemctl restart mariadb.service<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"memcached\">Memcached<\/h2>\n<p>  <\/p>\n<p>Memcached \u2014 \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0435 \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0435\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0445\u0435\u0448-\u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>  <\/p>\n<h3 id=\"ustanovka-6\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">apt-get install memcached php-memcached<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-6\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430<\/h3>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl enable memcached &amp;&amp; systemctl start memcached<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c apache2:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl restart apache2<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0447\u0442\u043e \u043c\u043e\u0434\u0443\u043b\u044c memcached \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 PHP, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043d\u0430\u0448 \u0441\u0430\u0439\u0442 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u2014 \u0432 phpinfo \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u0441\u0435\u043a\u0446\u0438\u044f Memcached.<\/em><\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f\u044b \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <code>memcached.conf<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/memcached.conf<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">netstat -tap | grep memcached<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"nastroyka-polzovatelya\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">adduser dev<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 <code>www-data<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">adduser dev www-data<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 <code>sudo<\/code> \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">usermod -aG sudo dev<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"nastroyka-sayta\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0430\u0439\u0442\u0430<\/h2>\n<p>  <\/p>\n<h3 id=\"sozdaem-katalog-dlya-sayta\">\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043a\u0430\u0442\u0430\u043b\u043e\u0433:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mkdir -p \/var\/www\/example.com\/{www,tmp} mkdir -p \/var\/www\/example.com\/log\/{nginx,apache}<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0434\u0430\u0435\u043c \u043f\u0440\u0430\u0432\u0430 \u043d\u0430 \u043f\u0430\u043f\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">chown -R www-data:www-data \/var\/www\/example.com\/www chmod -R 775 \/var\/www\/example.com\/www<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0438\u043d\u0434\u0435\u043a\u0441\u043d\u044b\u0439 \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/var\/www\/example.com\/www\/index.php<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&lt;?php phpinfo(); ?&gt;<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroyka-sayta-1\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0430\u0439\u0442\u0430<\/h3>\n<p>  <\/p>\n<h4 id=\"nginx-http\">Nginx http<\/h4>\n<p>  <\/p>\n<pre><code class=\"plaintext\">server {     listen       80;     server_name  example.com;     set $root_path \/var\/www\/example.com\/www;      access_log \/var\/www\/example.com\/log\/nginx\/access_log;     error_log \/var\/www\/example.com\/log\/nginx\/error_log;      root   $root_path;      gzip  on;     gzip_disable &quot;msie6&quot;;     gzip_min_length 1000;     gzip_vary on;     gzip_proxied    expired no-cache no-store private auth;     gzip_types      text\/plain text\/css application\/json application\/x-javascript text\/xml application\/xml application\/xml+rss;      location \/ {         location ~ [^\/]\\.ph(p\\d*|tml)$ {             try_files \/does_not_exists @fallback;         }          location ~* ^.+\\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|exe|pdf|ppt|tar|wav|bmp|rtf|js)$ {             try_files $uri $uri\/ @fallback;         }          location ~* \\.(?:css(\\.map)?|js(\\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {             expires 7d;             access_log off;         }          location ~* \\.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {             add_header Access-Control-Allow-Origin &quot;*&quot;;             expires 7d;             access_log off;         }          location = \/favicon.ico {             log_not_found off;             access_log off;         }          location = \/robots.txt {             log_not_found off;             access_log off;         }          location \/ {             try_files \/does_not_exists @fallback;         }     }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP     location @fallback {         proxy_pass http:\/\/127.0.0.1:8080;         proxy_redirect http:\/\/127.0.0.1:8080 \/;         proxy_set_header Host $host;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_set_header X-Forwarded-Proto $scheme;         access_log off;     }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP-FPM     location @fallback {         index index.php index.html index.htm;          fastcgi_pass unix:\/var\/run\/php\/php7.3-fpm.sock;         fastcgi_index index.php;         fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;         include fastcgi_params;         fastcgi_param DOCUMENT_ROOT $root_path;     } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044f\u0440\u043b\u044b\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ln -s \/etc\/nginx\/sites-available\/example.com.conf \/etc\/nginx\/sites-enabled\/example.com<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e \u043f\u043e\u0440\u0442\u0443 8080, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 apache, \u043a\u0440\u043e\u043c\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c (jpg, png, css \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435).<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"apache2-1\">apache2<\/h4>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/apache2\/sites-available\/example.com.conf<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&lt;VirtualHost 127.0.0.1:8080&gt;     Define root_domain example.com     Define root_path \/var\/www\/example.com      ServerName ${root_domain}     ServerAlias www.${root_domain}     DocumentRoot ${root_path}\/www      ErrorLog ${root_path}\/log\/apache\/error_log     TransferLog  ${root_path}\/log\/apache\/access_log      &lt;IfModule mod_dir.c&gt;         DirectoryIndex index.php index.html index.htm     &lt;\/IfModule&gt;      &lt;Directory \/var\/www\/example.com\/www&gt;         AllowOverride All         Options Indexes ExecCGI FollowSymLinks         Require all granted     &lt;\/Directory&gt;      &lt;IfModule setenvif_module&gt;         SetEnvIf X-Forwarded-Proto https HTTPS=on     &lt;\/IfModule&gt;      &lt;IfModule php7_module&gt;         php_admin_value upload_tmp_dir ${root_path}\/tmp         php_admin_value doc_root ${root_path}         php_value open_basedir    ${root_path}:\/usr\/local\/share\/smarty:\/usr\/local\/share\/pear         php_value post_max_size 512M         php_value upload_max_filesize 512M         php_flag short_open_tag On     &lt;\/IfModule&gt; &lt;\/VirtualHost&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044f\u0440\u043b\u044b\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ln -s \/etc\/apache2\/sites-available\/example.com.conf \/etc\/apache2\/sites-enabled\/example.com.conf<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"proveryaem\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nginx -t apachectl configtest<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl reload nginx systemctl reload apache2<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"https-suschestvuyuschiy-sertifikat\">https (\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0421\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442)<\/h3>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/nginx\/conf.d\/example.com.conf<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># \u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u0448\u0435\u043b \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442 \u0441 ip \u043d\u0430 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0434\u043e\u043c\u0435\u043d. server {     listen 80;     server_name \u0412\u0430\u0448_ip;     return 301 https:\/\/example.com$request_uri; }  server {     listen       443 ssl;     ssl on;     ssl_certificate \/etc\/nginx\/ssl\/cert.pem;     ssl_certificate_key \/etc\/nginx\/ssl\/cert.key;      server_name example.com;     set $root_path \/var\/www\/example.com\/www;      access_log \/var\/www\/example.com\/log\/nginx\/access_log;     error_log \/var\/www\/example.com\/log\/nginx\/error_log;     gzip  on;     gzip_disable &quot;msie6&quot;;     gzip_min_length 1000;     gzip_vary on;     gzip_proxied    expired no-cache no-store private auth;     gzip_types      text\/plain text\/css application\/json application\/x-javascript text\/xml application\/xml application\/xml+rss      root   $root_path;      location \/ {         location ~ [^\/]\\.ph(p\\d*|tml)$ {             try_files \/does_not_exists @fallback;         }          location ~* ^.+\\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|exe|pdf|ppt|tar|wav|bmp|rtf|js)$ {             try_files $uri $uri\/ @fallback;         }          location ~* \\.(?:css(\\.map)?|js(\\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {             expires 7d;             access_log off;         }          location ~* \\.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {             add_header Access-Control-Allow-Origin &quot;*&quot;;             expires 7d;             access_log off;         }          location = \/favicon.ico {             log_not_found off;             access_log off;         }          location = \/robots.txt {             log_not_found off;             access_log off;         }          location \/ {             try_files \/does_not_exists @fallback;         }     }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP     location @fallback {         proxy_pass http:\/\/127.0.0.1:8080;         proxy_redirect http:\/\/127.0.0.1:8080 \/;         proxy_set_header Host $host;         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;         proxy_set_header X-Forwarded-Proto $scheme;         access_log off;     }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP-FPM     location @fallback {         index index.php index.html index.htm;          fastcgi_pass unix:\/var\/run\/php\/php7.3-fpm.sock;         fastcgi_index index.php;         fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;         include fastcgi_params;         fastcgi_param DOCUMENT_ROOT $root_path;     } }<\/code><\/pre>\n<p>  <\/p>\n<p><em>\u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u043e \u043f\u043e\u0440\u0442\u0443 8080, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 apache, \u043a\u0440\u043e\u043c\u0435 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u043a \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u0430\u0439\u043b\u0430\u043c (jpg, png, css \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435).<\/em><\/p>\n<p>  <\/p>\n<h4 id=\"apache2-2\">Apache2<\/h4>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/apache2\/sites-available\/example.com.conf<\/code><\/pre>\n<p>  <\/p>\n<pre><code class=\"plaintext\">&lt;VirtualHost 127.0.0.1:8080&gt;     Define root_domain example.com     Define root_path \/var\/www\/example.com      ServerName ${root_domain}     ServerAlias www.${root_domain}     DocumentRoot ${root_path}\/www      ErrorLog ${root_path}\/log\/apache\/error_log     TransferLog  ${root_path}\/log\/apache\/access_log      &lt;IfModule mod_dir.c&gt;         DirectoryIndex index.php index.html index.htm     &lt;\/IfModule&gt;      &lt;Directory \/var\/www\/example.com\/www&gt;         AllowOverride All         Options Indexes ExecCGI FollowSymLinks         Require all granted     &lt;\/Directory&gt;      &lt;IfModule setenvif_module&gt;         SetEnvIf X-Forwarded-Proto https HTTPS=on     &lt;\/IfModule&gt;      &lt;IfModule php7_module&gt;         php_admin_value upload_tmp_dir ${root_path}\/tmp         php_admin_value doc_root ${root_path}         php_value open_basedir    ${root_path}:\/usr\/local\/share\/smarty:\/usr\/local\/share\/pear         php_value post_max_size 512M         php_value upload_max_filesize 512M         php_flag short_open_tag On     &lt;\/IfModule&gt; &lt;\/VirtualHost&gt;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u044f\u0440\u043b\u044b\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">ln -s \/etc\/apache2\/sites-available\/example.com.conf \/etc\/apache2\/sites-enabled\/example.com.conf<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"proveryaem-1\">\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c<\/h4>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nginx -t apachectl configtest<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">systemctl reload nginx systemctl reload apache2<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"ngx_pagespeed-on\">ngx_pagespeed on<\/h3>\n<p>  <\/p>\n<h4 id=\"zagruzka-dinamicheskogo-modulya-pagespeed\">\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f PageSpeed<\/h4>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <code>nginx.conf<\/code>:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">vi \/etc\/nginx\/nginx.conf<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043d\u0430\u0447\u0430\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">load_module modules\/ngx_pagespeed.so;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f PageSpeed \u0432 <code>http<\/code> \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u044d\u0442\u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u044b \u0432 \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c <code>example.com.conf<\/code> \u0432 \u0444\u0430\u0439\u043b\u0435 <code>\/etc\/nginx\/conf.d<\/code> \u043a\u0430\u0442\u0430\u043b\u043e\u0433.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u044d\u0448\u0430 pagespeed MessageBufferSize 10240; # \u041f\u0443\u0442\u044c \u043a \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u043a\u044d\u0448\u0430 pagespeed FileCachePath \/var\/cache\/nginx_pagespeed;  server {     listen       80;     server_name example.com;     set $root_path \/var\/www\/example.com\/www;      # \u0437\u0430\u043f\u0443\u0441\u043a pagespeed     pagespeed on;      root   $root_path;      # \u0410\u0434\u0440\u0435\u0441 \u0438 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f \u0441\u0430\u0439\u0442\u0430     pagespeed LoadFromFile &quot;http:\/\/www.example.com&quot; &quot;\/var\/www\/example.com\/www&quot;;      access_log \/var\/www\/example.com\/log\/nginx\/access_log;     error_log \/var\/www\/example.com\/log\/nginx\/error_log;      # \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432     pagespeed RewriteLevel CoreFilters;     pagespeed EnableFilters collapse_whitespace,remove_comments;     pagespeed DisableFilters rewrite_images;      gzip  on;     gzip_disable &quot;msie6&quot;;     gzip_min_length 1000;     gzip_vary on;     gzip_proxied    expired no-cache no-store private auth;     gzip_types      text\/plain text\/css application\/json application\/x-javascript text\/xml application\/xml application\/xml+rss;      location \/ {         location ~ [^\/]\\.ph(p\\d*|tml)$ {             try_files \/does_not_exists @fallback;         }          location ~* ^.+\\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|xlsx|exe|pdf|ppt|tar|wav|bmp|rtf|js)$ {             try_files $uri $uri\/ @fallback;         }          location ~* \\.(?:css(\\.map)?|js(\\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {             expires 7d;             access_log off;         }          location ~* \\.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {             add_header Access-Control-Allow-Origin &quot;*&quot;;             expires 7d;             access_log off;         }          location = \/favicon.ico {             log_not_found off;             access_log off;         }          location = \/robots.txt {             log_not_found off;             access_log off;         }          location \/ {             try_files \/does_not_exists @fallback;         }          # \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0430\u0434\u0440\u0435\u0441\u043e\u0432         location ~ &quot;\\.pagespeed\\.([a-z]\\.)?[a-z]{2}\\.[^.]{10}\\.[^.]+&quot; {             add_header &quot;&quot; &quot;&quot;;         }         location ~ &quot;^\/pagespeed_static\/&quot; { }         location ~ &quot;^\/ngx_pagespeed_beacon$&quot; { }     }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP         location @fallback {             proxy_pass http:\/\/127.0.0.1:8080;             proxy_redirect http:\/\/127.0.0.1:8080 \/;             proxy_set_header Host $host;             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;             proxy_set_header X-Forwarded-Proto $scheme;             access_log off;        }      # \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f PHP-FPM         location @fallback {             index index.php index.html index.htm;              fastcgi_pass unix:\/var\/run\/php\/php7.3-fpm.sock;             fastcgi_index index.php;             fastcgi_param SCRIPT_FILENAME $root_path$fastcgi_script_name;             include fastcgi_params;             fastcgi_param DOCUMENT_ROOT $root_path;        } }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u044d\u0448\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">mkdir \/var\/cache\/nginx_pagespeed\/ chown www-data:www-data \/var\/cache\/nginx_pagespeed\/<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e Nginx \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">nginx -t nginx -s reload<\/code><\/pre>\n<\/div>\n<p> \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\/post\/509122\/\"> https:\/\/habr.com\/ru\/post\/509122\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/509122\/\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0434\u0432\u0443\u0445 web-\u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u0441 \u0446\u0435\u043b\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 \u043d\u0438\u0445, \u0433\u0434\u0435 Nginx \u2014 \u043a\u0430\u043a frontend \u0438 Apache \u2014 \u043a\u0430\u043a backend.<br \/>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0442\u0438 \u0440\u0435\u0447\u044c \u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f\u0445: <strong>Apache2, Nginx, ngx_pagespeed, PHP, PHP-FPM, MariaDB \u0438 MemCached<\/strong>.<\/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-306237","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306237","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=306237"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/306237\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=306237"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=306237"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=306237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}