{"id":272764,"date":"2016-01-24T19:54:05","date_gmt":"2016-01-24T16:54:05","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=272764"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=272764","title":{"rendered":"\u0424\u043e\u0440\u0441\u0430\u0436 \u043f\u043e\u0434 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439 \u043d\u0430 Symfony + HHVM + MongoDB + CouchDB + Varnish"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b5b\/b46\/2ef\/b5bb462ef2504f66b8c43d6649a2f0c5.jpg\"\/><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 1 \u043c\u043b\u043d. \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0432 \u0434\u0435\u043d\u044c (\u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API), \u043e \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044f\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0442\u0435\u0445 \u0433\u0440\u0430\u0431\u043b\u044f\u0445 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u044f\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f. \u041f\u043e\u0435\u0445\u0430\u043b\u0438&#8230;<a name=\"habracut\"><\/a><\/p>\n<p>  <\/p>\n<h3>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435<\/h3>\n<p>  \u0421\u0438\u0441\u0442\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 Symfony 2.3 \u0438 \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0440\u043e\u043f\u043b\u0435\u0442\u0430\u0445 <a href=\"https:\/\/m.do.co\/c\/d094555af590\">DigitalOcean<\/a>, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0431\u043e\u0434\u0440\u043e, \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439.<\/p>\n<p>  <\/p>\n<h3>Symfony<\/h3>\n<p>  \u0423 Symfony \u0435\u0441\u0442\u044c \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <a href=\"http:\/\/symfony.com\/doc\/current\/components\/http_kernel\/introduction.html#the-kernel-terminate-event\">kernel.terminate<\/a>. \u0417\u0434\u0435\u0441\u044c \u0432 \u0444\u043e\u043d\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u043a\u043b\u0438\u0435\u043d\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043e\u0442\u0432\u0435\u0442 \u043e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u0441\u044f \u0442\u044f\u0436\u0451\u043b\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 (\u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b\u044b, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u044d\u0448, \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0411\u0414).<\/p>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0439 \u0431\u0430\u043d\u0434\u043b Symfony \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u043d\u0434\u043e\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0431\u0430\u043d\u0434\u043b\u044b \u0430\u0434\u043c\u0438\u043d\u043a\u0438, \u0430 \u0432 API \u043d\u0435 \u043d\u0443\u0436\u043d\u044b \u0431\u0430\u043d\u0434\u043b\u044b \u0430\u0434\u043c\u0438\u043d\u043a\u0438 \u0438 \u0444\u0440\u043e\u043d\u0442\u0435\u043d\u0434\u0430 \u0438 \u0442.\u0434.). \u041f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445 \u0431\u0430\u043d\u0434\u043b\u043e\u0432 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u043a\u0440\u0430\u0449\u0451\u043d \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b, \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438\u0445, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0431\u043e\u043b\u044c\u0448\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 \/app\/BaseAppKernel.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  use Symfony\\Component\\HttpKernel\\Kernel; use Symfony\\Component\\Config\\Loader\\LoaderInterface;  class BaseAppKernel extends Kernel {     protected $bundle_list = array();      public function registerBundles()     {         \/\/ \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u043d\u0434\u043b\u043e\u0432         $this-&gt;bundle_list = array(             new Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle(),             new Symfony\\Bundle\\SecurityBundle\\SecurityBundle(),             new Symfony\\Bundle\\TwigBundle\\TwigBundle(),             new Symfony\\Bundle\\MonologBundle\\MonologBundle(),             new Symfony\\Bundle\\AsseticBundle\\AsseticBundle(),             new Doctrine\\Bundle\\DoctrineBundle\\DoctrineBundle(),             new Sensio\\Bundle\\FrameworkExtraBundle\\SensioFrameworkExtraBundle(),             new Doctrine\\Bundle\\MongoDBBundle\\DoctrineMongoDBBundle()         );          \/\/ \u0417\u0434\u0435\u0441\u044c \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432\u0441\u0435 \u0431\u0430\u043d\u0434\u043b\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b         if ($this-&gt;needLoadAllBundles()) {             \/\/ Admin             $this-&gt;addBundle(new Sonata\\BlockBundle\\SonataBlockBundle());             $this-&gt;addBundle(new Sonata\\CacheBundle\\SonataCacheBundle());             $this-&gt;addBundle(new Sonata\\jQueryBundle\\SonatajQueryBundle());             $this-&gt;addBundle(new Sonata\\AdminBundle\\SonataAdminBundle());             $this-&gt;addBundle(new Knp\\Bundle\\MenuBundle\\KnpMenuBundle());             $this-&gt;addBundle(new Sonata\\DoctrineMongoDBAdminBundle\\SonataDoctrineMongoDBAdminBundle());              \/\/ Frontend             $this-&gt;addBundle(new Likebtn\\FrontendBundle\\LikebtnFrontendBundle()); \t\t\t             \/\/ API             $this-&gt;addBundle(new Likebtn\\ApiBundle\\LikebtnApiBundle());         }          return $this-&gt;bundle_list;     }      \/**      * \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043d\u0443\u0436\u043d\u043e \u043b\u0438 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0431\u0430\u043d\u0434\u043b\u044b.      * \u0415\u0441\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0432 dev- \u0438\u043b\u0438 text-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u044d\u0448\u0430 prod-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f,      * \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0432\u0441\u0435 \u0431\u0430\u043d\u0434\u043b\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b      *\/     public function needLoadAllBundles()     {         if (in_array($this-&gt;getEnvironment(), array('dev', 'test')) ||             $_SERVER['SCRIPT_NAME'] == 'app\/console' ||             strstr($_SERVER['SCRIPT_NAME'], 'phpunit')         ) {             return true;         } else {             return false;         }     }      \/**      * \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u0430\u043d\u0434\u043b\u0430 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u044b\u0445      *\/     public function addBundle($bundle)     {         if (in_array($bundle, $this-&gt;bundle_list)) {             return false;         }         $this-&gt;bundle_list[] = $bundle;     }      public function registerContainerConfiguration(LoaderInterface $loader)     {         $loader-&gt;load(__DIR__.'\/config\/config_'.$this-&gt;getEnvironment().'.yml');     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043b\u0430\u0441\u0441 \/app\/AppKernel.api.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">&lt;?php  require_once __DIR__.'\/BaseAppKernel.php';  class AppKernel extends BaseAppKernel {     public function registerBundles()     {         parent::registerBundles();         $this-&gt;addBundle(new Likebtn\\ApiBundle\\LikebtnApiBundle());         return $this-&gt;bundle_list;     } } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0424\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \/web\/app.php<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"php\">\/\/ \u0412\u0441\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u043f\u043e\u0434\u0434\u043e\u043c\u0435\u043d\u0430\u0445 \/\/ \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u043e\u0434\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438,  \/\/ \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u0443\u0442\u044c \u0432 $_SERVER['REQUEST_URI'] if (strstr($_SERVER['HTTP_HOST'], 'admin.')) {     \/\/ \u0410\u0434\u043c\u0438\u043d\u043a\u0430     require_once __DIR__.'\/..\/app\/AppKernel.admin.php'; } elseif (strstr($_SERVER['HTTP_HOST'], 'api.')) {     \/\/ API     require_once __DIR__.'\/..\/app\/AppKernel.api.php'; } else {     \/\/ \u0424\u0440\u043e\u043d\u0442\u0435\u043d\u0434     require_once __DIR__.'\/..\/app\/AppKernel.php'; } $kernel = new AppKernel('prod', false); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0425\u0438\u0442\u0440\u043e\u0441\u0442\u044c \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0432\u0441\u0435 \u0431\u0430\u043d\u0434\u043b\u044b \u043d\u0443\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432 dev-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438 \u0438 \u0432 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043a\u044d\u0448\u0430 \u043d\u0430 prod-\u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0438.<\/p>\n<p>  <\/p>\n<h3>MongoDB<\/h3>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0411\u0414 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f MongoDB \u043d\u0430 <a href=\"https:\/\/compose.io\/\">Compose.io<\/a>. \u0411\u0430\u0437\u0443 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u0442\u043e\u043c \u0436\u0435 \u0434\u0430\u0442\u0430\u0446\u0435\u043d\u0442\u0440\u0435, \u0447\u0442\u043e \u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u2014 \u0431\u043b\u0430\u0433\u043e, Compose <a href=\"https:\/\/www.compose.io\/digitalocean\/\">\u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c<\/a> \u0411\u0414 \u0432 DigitalOcean.<\/p>\n<p>  \u0412 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0431\u044b\u043b\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u0438\u0437-\u0437\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0431\u0449\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e \u0441\u043d\u0438\u0436\u0430\u0442\u044c\u0441\u044f. \u0420\u0435\u0448\u0451\u043d \u0432\u043e\u043f\u0440\u043e\u0441 \u0431\u044b\u043b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0434\u043b\u044f MongoDB \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u044e\u0442, \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u044b\u0431\u043e\u0440\u0430 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430 ($in, $gt \u0438\u043b\u0438 $lt), \u0442\u043e \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0438 \u043f\u0440\u0438 \u043a\u0430\u043a\u0438\u0445 \u043e\u0431\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"javascript\">{&quot;_id&quot;:{&quot;$gt&quot;:ObjectId('52d89f120000000000000000')},&quot;ip&quot;:&quot;140.101.78.244&quot;} <\/code><\/pre>\n<p>  \u0422\u0430\u043a \u0432\u043e\u0442, \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a. \u0412\u043e\u0442 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u0432\u044b\u0431\u043e\u0440\u043e\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u043e\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 (\u043f\u043e\u0447\u0435\u043c\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a\u043e\u0439, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"http:\/\/blog.mongolab.com\/2012\/06\/cardinal-ins\/\">\u0437\u0434\u0435\u0441\u044c<\/a>):  <\/p>\n<ol>\n<li>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432 \u0438\u043d\u0434\u0435\u043a\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u044b\u0431\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/li>\n<li>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043b\u044f, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0438\u0434\u0451\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0430.<\/li>\n<li>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043f\u043e\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u044e\u0442 \u0432 \u0432\u044b\u0431\u043e\u0440\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0430.<\/li>\n<\/ol>\n<p>  \u0418 \u0432\u0443\u0430\u043b\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/53f\/eda\/c12\/53fedac12a0444279c1aaf08263f1a26.png\"\/><\/p>\n<p>  <\/p>\n<h3>CouchDB<\/h3>\n<p>  \u0414\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0430 \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 CouchDB \u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e JavaScript, \u043b\u0438\u0448\u043d\u0438\u0439 \u0440\u0430\u0437 \u043d\u0435 \u0434\u0451\u0440\u0433\u0430\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0420\u0430\u043d\u0435\u0435 \u0441 \u0434\u0430\u043d\u043d\u043e\u0439 \u0411\u0414 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438, \u043f\u043e\u0434\u043a\u0443\u043f\u0438\u043b\u0430 \u0444\u0440\u0430\u0437\u0430 \u00abCouchDB \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0438\u043c\u0435\u043d\u043d\u043e \u0434\u043b\u044f \u0432\u0435\u0431\u0430\u00bb.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0443\u0436\u0435 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0438 \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043e\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0441 \u043d\u0430\u0448\u0438\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c, CouchDB \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0445\u043b\u0451\u0431\u044b\u0432\u0430\u043b\u0430\u0441\u044c. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0441\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u043f\u043e CouchDB \u043f\u0440\u044f\u043c\u043e \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0451 \u0434\u043b\u044f \u0447\u0430\u0441\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043c\u044b, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043d\u0435 \u043f\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u0438 \u043f\u043e\u043d\u0430\u0434\u0435\u044f\u043b\u0438\u0441\u044c \u043d\u0430 \u0430\u0432\u043e\u0441\u044c. \u041e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Memcached \u0438 \u043f\u0435\u0440\u0435\u0431\u0440\u043e\u0441\u043a\u0430 \u0438\u0445 \u0432 CouchDB \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043a\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0443 CouchDB \u0435\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0432\u0438\u0437\u0438\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0448\u0442\u0430\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u041e\u0431 \u044d\u0442\u043e\u043c \u0443\u0437\u043d\u0430\u043b\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u0435\u0442\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u0437\u0434\u043d\u043e. \u041f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 <a href=\"https:\/\/wiki.apache.org\/couchdb\/Compaction\">\u0443\u043f\u043b\u043e\u0442\u043d\u0435\u043d\u0438\u044f<\/a>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043d\u0430\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u0439, \u0441\u0442\u0430\u0440\u044b\u0435 \u0440\u0435\u0432\u0438\u0437\u0438\u0438 \u0443\u0434\u0430\u043b\u044f\u0435\u0442, \u043d\u043e \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u0435\u0432\u0438\u0437\u0438\u0438 \u043a\u0443\u0448\u0430\u044e\u0442.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/152\/035\/244\/152035244bf04ba095afaec997233732.png\"\/><\/p>\n<p>  Futon \u2014 \u0432\u0435\u0431-\u0430\u0434\u043c\u0438\u043d\u043a\u0430 CouchDB, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 \/_utils\/ \u0432\u0441\u0435\u043c, \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0430\u043d\u043e\u043d\u0438\u043c\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u0441\u0435\u043c \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0431\u0430\u0437\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u2014 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 CouchDB \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 [httpd_db_handlers] (\u0430\u0434\u043c\u0438\u043d \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0442\u043e\u0436\u0435 \u0442\u0435\u0440\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432):  <\/p>\n<pre><code class=\"bash\">_all_docs ={couch_mrview_http, handle_all_docs_req} _changes ={couch_httpd_db, handle_changes_req} <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u0440\u0430\u0441\u0441\u043b\u0430\u0431\u0438\u0442\u044c\u0441\u044f CouchDB \u043d\u0435 \u0434\u0430\u0432\u0430\u043b\u0430.<\/p>\n<p>  <\/p>\n<h3>HHVM<\/h3>\n<p>  \u0411\u044d\u043a\u0435\u043d\u0434\u044b, \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0449\u0438\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442, \u043a\u0440\u0443\u0442\u044f\u0442\u0441\u044f \u043d\u0430 <a href=\"http:\/\/hhvm.com\/\">HHVM<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0440\u0430\u0437\u044b \u0431\u043e\u0434\u0440\u0435\u0435 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u0441\u0432\u044f\u0437\u043a\u0438 PHP-FPM + APC. \u0411\u043b\u0430\u0433\u043e Symfony 2.3 <a href=\"http:\/\/symfony.com\/blog\/symfony-2-3-achieves-100-hhvm-compatibility\">\u043d\u0430 100% \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u0430<\/a> \u0441 HHVM. <a href=\"https:\/\/docs.hhvm.com\/hhvm\/installation\/linux#debian-8-jessie\">\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f<\/a> HHVM \u043d\u0430 Debian 8 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b HHVM \u043c\u043e\u0433 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0431\u0430\u0437\u043e\u0439 MongoDB, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 <a href=\"https:\/\/github.com\/mongofill\/mongofill-hhvm\">Mongofill for HHVM<\/a>, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u043d\u0430\u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043d\u0430 C++, \u043d\u0430\u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443 \u043d\u0430 PHP. \u0418\u0437-\u0437\u0430 <a href=\"https:\/\/github.com\/mongofill\/mongofill-hhvm\/issues\/45\">\u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e<\/a> <a href=\"https:\/\/github.com\/mongofill\/mongofill-hhvm\/pull\/47\">\u0431\u0430\u0433\u0430<\/a>, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0448\u0438\u0431\u043e\u043a \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0411\u0414 \u0432\u044b\u0432\u0430\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f: <\/p>\n<blockquote><p>Fatal error: Class undefined: MongoCursorException<\/p><\/blockquote>\n<p> \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u044d\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435.<\/p>\n<p>  \u041d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439, \u0435\u0441\u043b\u0438 \u043d\u0430 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0431\u044d\u043a\u0435\u043d\u0434\u0435 HHVM \u0432\u0434\u0440\u0443\u0433 \u0443\u043f\u0430\u0434\u0451\u0442 (\u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u043b\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437, \u043d\u043e \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043d\u0435 \u043f\u043e\u0432\u043b\u0438\u044f\u043b\u043e, \u0442.\u043a. Varnish \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u043b \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u0431\u044d\u043a\u0435\u043d\u0434), \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442-\u0430\u0432\u0442\u043e\u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u043e \u043a\u0440\u043e\u043d\u0443, \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 hhvm, \u0438, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e, \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u0442 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u0430\u0434\u043c\u0438\u043d\u0443:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041c\u043e\u043d\u0438\u0442\u043e\u0440 HHVM<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"bash\">#!\/bin\/bash DATE_TIME=`date +%Y-%m-%d_%H:%M:%S` STATUS=`ps aux | grep &quot;\/usr\/bin\/hhvm&quot; | wc -l` if [ $STATUS == &quot;1&quot; ]    then    MESSAGE=&quot;${DATE_TIME} HHVM is down. Starting...&quot;;    HOSTNAME=`hostname`    echo $MESSAGE;    service hhvm start    echo -e $MESSAGE | mail -s &quot;[${HOSTNAME}] Started hhvm service&quot; &quot;admin@email.com&quot;; else    echo &quot;${DATE_TIME} HHVM is running&quot;; fi <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h3>Varnish<\/h3>\n<p>  \u0414\u043b\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043e\u0442\u0434\u0430\u0447\u0438 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u043d\u0441\u0442\u0440 Varnish. \u0417\u0434\u0435\u0441\u044c \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 varnishd \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u0431\u0438\u0432\u0430\u043b \u0434\u0435\u0442\u0435\u0439. \u0412\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">varnishd[23437]: Child (23438) not responding to CLI, killing it. varnishd[23437]: Child (23438) died signal=3 varnishd[23437]: Child cleanup complete varnishd[23437]: child (3786) Started varnishd[23437]: Child (3786) said Child starts <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043b\u043e \u043a \u043e\u0447\u0438\u0441\u0442\u043a\u0435 \u043a\u044d\u0448\u0430 \u0438 \u0440\u0435\u0437\u043a\u043e\u043c\u0443 \u0440\u043e\u0441\u0442\u0443 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u0446\u0435\u043b\u043e\u043c. \u041f\u0440\u0438\u0447\u0438\u043d \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f, \u043a\u0430\u043a \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u043f\u0440\u0435\u0432\u0435\u043b\u0438\u043a\u043e\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e, \u043a\u0430\u043a \u0438 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u0438 \u0440\u0435\u0446\u0435\u043f\u0442\u043e\u0432 \u043f\u043e \u043b\u0435\u0447\u0435\u043d\u0438\u044e. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0433\u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>-p cli_timeout=30s<\/code> \u0432 \/etc\/default\/varnish, \u043d\u043e \u0434\u0435\u043b\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043d\u0435 \u0432 \u043d\u0451\u043c. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0438 \u043f\u0435\u0440\u0435\u0431\u043e\u0440\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u043b\u043e \u044d\u0442\u043e \u0432 \u0442\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u043a\u043e\u0433\u0434\u0430 Varnish \u043d\u0430\u0447\u0438\u043d\u0430\u043b \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0443\u0434\u0430\u043b\u044f\u0442\u044c \u0438\u0437 \u043a\u044d\u0448\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435. \u041e\u043f\u044b\u0442\u043d\u044b\u043c \u043f\u0443\u0442\u0451\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0431\u044b\u043b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <b>beresp.ttl<\/b> \u0432 default.vcl, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0432\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430 \u0432 \u043a\u044d\u0448\u0435, \u0438 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c:<\/p>\n<pre><code class=\"bash\">sub vcl_fetch {     \/* Set how long Varnish will keep it*\/     set beresp.ttl = 7d; } <\/code><\/pre>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 beresp.ttl \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c, \u0447\u0442\u043e\u0431\u044b \u0441\u0442\u0430\u0440\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0443\u0434\u0430\u043b\u044f\u043b\u0438\u0441\u044c (expired objects) \u0438\u0437 \u043a\u044d\u0448\u0430 \u0440\u0430\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u043d\u043e\u0432\u044b\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u043c \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u0430 (nuked objects) \u0432 \u043a\u044d\u0448\u0435:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/868\/15b\/d5c\/86815bd5c08d433ab1cc6ec7c68b2f35.png\"\/><\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u043d\u0442 \u043a\u044d\u0448-\u043f\u043e\u043f\u0430\u0434\u0430\u043d\u0438\u0439 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e \u0432 \u0440\u0430\u0439\u043e\u043d\u0435 <b>91%<\/b>:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/142\/054\/2b7\/1420542b728c463f878c2e648f2fe244.png\"\/><\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 \u0432\u0441\u0442\u0443\u043f\u0438\u043b\u0438 \u0432 \u0441\u0438\u043b\u0443, Varnish \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c. \u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0447\u0438\u0441\u0442\u043a\u0435 \u043a\u044d\u0448\u0430 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u0432\u044b\u0442\u0435\u043a\u0430\u044e\u0449\u0438\u043c\u0438. \u0412\u043e\u0442 \u0445\u0438\u0442\u0440\u043e\u0441\u0442\u044c, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0431\u0435\u0437 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 Varnish \u0438 \u043f\u043e\u0442\u0435\u0440\u0438 \u043a\u044d\u0448\u0430:<\/p>\n<pre><code class=\"bash\">varnishadm -T 0.0.0.0:6087 -S \/etc\/varnish\/secret vcl.load config01 \/etc\/varnish\/default.vcl vcl.use config01 quit <\/code><\/pre>\n<p>  <i>config01 \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440: newconfig, reload \u0438 \u0442.\u0434.<\/i><\/p>\n<p>  <\/p>\n<h3>CloudFlare<\/h3>\n<p>  CloudFlare \u043f\u0440\u0438\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0432\u0441\u0451 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0438 \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0430\u0442\u0438\u043a\u0443, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 SSL-\u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b.<\/p>\n<p>  \u0423 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 API \u2014 \u043e\u043d\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u0438 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u0432\u043e\u0434 \u043a\u0430\u043f\u0447\u0438 \u00abChallenge Passage\u00bb. \u041a\u0430\u043a \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, CloudFlare \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <a href=\"https:\/\/www.projecthoneypot.org\">Project Honey Pot<\/a> \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u2014 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u044b\u043b\u044c\u0449\u0438\u043a\u0438 \u0441\u043f\u0430\u043c\u0430, \u0438\u043c-\u0442\u043e \u0438 \u0432\u044b\u0434\u0430\u0432\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435. \u0422\u0435\u0445\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 CloudFlare \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043c\u043e\u0433\u043b\u0430 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u0432\u0440\u0430\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 Security Level \u043d\u0430 Essentially Off \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 CloudFlare:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/839\/d9e\/9b2\/839d9e9b2d254fd5b0d14c127993728a.png\"\/><\/p>\n<p>  <\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u043a\u0430 \u0432\u0441\u0451. \u041d\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u043e\u0441\u043b\u0430 \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0430\u043d\u0430\u043b\u0438\u0437 \u0438 \u043f\u043e\u0438\u0441\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u0439 \u0431\u044b\u043b\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043c\u0435\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u043c. \u0411\u0443\u0434\u0435\u043c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u044b, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u044d\u043b\u0435\u0433\u0430\u043d\u0442\u043d\u044b\u0435 \u043f\u0443\u0442\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.               <\/p>\n<div class=\"clear\"><\/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:\/\/habrahabr.ru\/post\/275661\/\"> https:\/\/habrahabr.ru\/post\/275661\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b5b\/b46\/2ef\/b5bb462ef2504f66b8c43d6649a2f0c5.jpg\"\/><\/p>\n<p>  \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0445\u043e\u0442\u0438\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 1 \u043c\u043b\u043d. \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0439 \u0432 \u0434\u0435\u043d\u044c (\u0431\u0435\u0437 \u0443\u0447\u0451\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API), \u043e \u0442\u043e\u043d\u043a\u043e\u0441\u0442\u044f\u0445 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e \u0442\u0435\u0445 \u0433\u0440\u0430\u0431\u043b\u044f\u0445 \u0438 \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u044b\u0445 \u043a\u0430\u043c\u043d\u044f\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f. \u041f\u043e\u0435\u0445\u0430\u043b\u0438&#8230;<\/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-272764","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272764","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=272764"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/272764\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=272764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=272764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=272764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}