{"id":216181,"date":"2014-03-18T11:46:03","date_gmt":"2014-03-18T07:46:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=216181"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=216181","title":{"rendered":"<span class=\"post_title\">\u0412\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 C++, \u0438\u043b\u0438 \u0443\u043a\u0440\u043e\u0449\u0435\u043d\u0438\u0435 \u0434\u0435\u043c\u043e\u043d\u0430 FastCGI<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043a\u0430\u043a NodeJS, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0441\u0443\u0449\u0438\u0439 \u043f\u0443\u0441\u0442\u044f\u043a. \u0421\u043a\u0430\u0447\u0430\u043b \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a, \u0441\u0432\u0430\u044f\u043b js \u0432 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430 \u0438 \u043c\u043e\u0436\u043d\u043e \u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c express \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u043e\u043c, \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438, \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u043c\u0438. \u0422\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0441\u043a\u0443\u0447\u043d\u043e. \u0418 \u0441\u0442\u0430\u043b\u043e \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u043a\u0430\u043a \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043b\u0430 \u0443 \u043c\u043e\u0435\u0433\u043e \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0433\u043e \u0421++, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u0436\u0435 5 \u043b\u0435\u0442 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0441\u044f. \u0412 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u043b\u044c\u0441\u0442\u0438\u043b \u043c\u0435\u043d\u044f ActionScript \u0438 \u043f\u0440\u043e\u0447\u0438\u0439 JavaScript, \u0430 \u043e \u0434\u043e\u0431\u0440\u043e\u043c \u0434\u0440\u0443\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0440\u0430\u0437 \u0432\u044b\u0440\u0443\u0447\u0430\u043b, \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u0437\u0430\u0431\u044b\u043b. \u0412 \u0441\u0432\u0435\u0442\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/yandex\/blog\/209324\/\">\u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445<\/a> <a href=\"http:\/\/habrahabr.ru\/company\/yandex\/blog\/214069\/\">\u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u043e Configurable Omnipotent Custom Applications Integrated Network Engine (\u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043e Cocaine), \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c Fastcgi Daemon, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 HTTP-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Cocaine. \u0418 \u0442\u0430\u043a, \u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<blockquote><p>Fastcgi Daemon \u2014 Yandex&#8217;s opensource framework for design highload FastCGI applications on C++.  <\/p><\/blockquote>\n<p>  \u0422\u043e \u0435\u0441\u0442\u044c<\/p>\n<blockquote><p>Fastcgi Daemon \u2014 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 Yandex \u0438 \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 FastCGI-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 C++.  <\/p><\/blockquote>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044d\u0442\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u0432\u044b \u043d\u0430\u0439\u0434\u0451\u0442\u0435 \u0432 README \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f.<br \/>  \u0411\u043e\u043b\u044c\u0448\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0437\u0434\u0435\u0441\u044c <a href=\"https:\/\/github.com\/lmovsesjan\/Fastcgi-Daemon\/wiki\/_pages\">github.com\/lmovsesjan\/Fastcgi-Daemon\/wiki\/_pages<\/a>, \u043d\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0438 \u0435\u0451 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0442\u0430\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043e\u0434\u043d\u0443 \u0441\u0442\u0440\u043e\u043a\u0443:<\/p>\n<pre><code class=\"bash\">sudo apt-get install fastcgi-daemon2-init libfastcgi-daemon2-dev libfastcgi2-syslog <\/code><\/pre>\n<p>  \u041d\u043e \u0432 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 Ubuntu, \u0434\u0430 \u0438 \u0432 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u0438\u0445 (\u043c\u043e\u0436\u0435\u0442 \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b), \u044d\u0442\u0438 \u043f\u0430\u043a\u0435\u0442\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u0438\u0437\u044b\u0441\u043a\u0430\u043d\u0438\u044f, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430. \u0412\u0441\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u043d\u0438\u0436\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 deb-\u0444\u0430\u0439\u043b\u044b \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0431\u0440\u0430\u0442\u044c \u0437\u0434\u0435\u0441\u044c <a href=\"https:\/\/github.com\/nickalie\/HelloFastCGI\">github.com\/nickalie\/HelloFastCGI<\/a><\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h2>\n<p>  \u041f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f Ubuntu, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b \u043d\u0430 Ubuntu 12.04 64 bit \u0441\u043e \u0441\u0432\u0435\u0436\u0438\u043c\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438.<br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b:<\/p>\n<pre><code class=\"bash\">sudo apt-get install -y build-essential git debhelper automake1.9 autotools-dev libboost-dev libboost-thread-dev libfcgi-dev libxml2-dev libboost-regex-dev libtool libssl-dev autoconf-archive <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043b\u043e\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 Fastcgi Daemon. \u0422\u0443\u0442 \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440 2 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430:  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/golubtsov\/Fastcgi-Daemon\">github.com\/golubtsov\/Fastcgi-Daemon<\/a> \u2014 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 \u0433\u043e\u0434 \u043d\u0430\u0437\u0430\u0434. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u0432 <a href=\"https:\/\/github.com\/Kobolog\/cocaine-docs-ru\/wiki\/HTTP-FastCGI\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a Cocaine<\/a>  <\/li>\n<li><a href=\"https:\/\/github.com\/lmovsesjan\/Fastcgi-Daemon\">github.com\/lmovsesjan\/Fastcgi-Daemon<\/a> \u2014 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0436\u0438\u0432\u044b\u043c, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043a\u043e\u043c\u043c\u0438\u0442 21 \u0434\u0435\u043d\u044c \u043d\u0430\u0437\u0430\u0434. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u043d\u044f\u0442\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 API \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.  <\/li>\n<\/ul>\n<p>  \u042f \u0432\u044b\u0431\u0440\u0430\u043b \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/golubtsov\/Fastcgi-Daemon.git <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0430\u043f\u043a\u0443 \u0441\u043e \u0441\u0432\u0435\u0436\u0435\u0441\u043a\u0430\u0447\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c<\/p>\n<pre><code class=\"bash\">cd Fastcgi-Daemon <\/code><\/pre>\n<p>  \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443<\/p>\n<pre><code class=\"bash\">dpkg-buildpackage -rfakeroot <\/code><\/pre>\n<p>  \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 deb-\u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438. \u0414\u0435\u043b\u0430\u0435\u043c <\/p>\n<pre><code class=\"bash\">cd .. <\/code><\/pre>\n<p>  \u0438<\/p>\n<pre><code class=\"bash\">sudo dpkg -i .\/libfastcgi-daemon2-dev_2.10-13_amd64.deb \\   .\/libfastcgi-daemon2_2.10-13_amd64.deb \\   .\/fastcgi-daemon2-init_2.10-13_amd64.deb \\   .\/fastcgi-daemon2_2.10-13_amd64.deb \\   .\/libfastcgi2-syslog_2.10-13_amd64.deb <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 FastCGI. \u042f \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043d\u0443\u0436\u0434 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e nginx, \u0442\u043e\u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/p>\n<pre><code class=\"bash\">sudo apt-get install nginx <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u0435\u0436\u0430\u0439\u0448\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u044d\u0442\u043e\u0433\u043e \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0434\u0435\u043b\u0430\u0435\u043c<\/p>\n<pre><code class=\"bash\">sudo add-apt-repository ppa:nginx\/stable && sudo apt-get update <\/code><\/pre>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043f\u043e\u043a\u043e\u043d\u0447\u0435\u043d\u043e. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0448\u0435\u043c\u0443 \u043f\u0435\u0440\u0432\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e.<\/p>\n<h2>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h2>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b HelloFastCGI.cpp \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code>#include &lt;fastcgi2\/component.h&gt; #include &lt;fastcgi2\/component_factory.h&gt; #include &lt;fastcgi2\/handler.h&gt; #include &lt;fastcgi2\/request.h&gt;  #include &lt;iostream&gt; #include &lt;sstream&gt;  class HelloFastCGI : virtual public fastcgi::Component, virtual public fastcgi::Handler {     public:         HelloFastCGI(fastcgi::ComponentContext *context) :                 fastcgi::Component(context)         {          }          virtual void onLoad()         {          }          virtual void onUnload()         {          }          virtual void handleRequest(fastcgi::Request *request, fastcgi::HandlerContext *context)         {                 request-&gt;setContentType(&quot;text\/plain&quot;);                 std::stringbuf buffer(&quot;Hello &quot; + (request-&gt;hasArg(&quot;name&quot;) ? request-&gt;getArg(&quot;name&quot;) : &quot;stranger&quot;));                 request-&gt;write(&buffer);         } };  FCGIDAEMON_REGISTER_FACTORIES_BEGIN() FCGIDAEMON_ADD_DEFAULT_FACTORY(&quot;HelloFastCGIFactory&quot;, HelloFastCGI) FCGIDAEMON_REGISTER_FACTORIES_END() <\/code><\/pre>\n<p>  \u041c\u0435\u0442\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0441 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u0435\u0442 \u2014 handleRequest. \u0418\u043c\u0435\u043d\u043d\u043e \u043e\u043d \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u0438\u0437 \u043a\u043e\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u044d\u0442\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435, \u043d\u043e \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u043e\u044f\u0441\u043d\u044e. \u0415\u0441\u043b\u0438 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 (POST \u0438\u043b\u0438 GET) \u0435\u0441\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u201cname\u201d, \u0442\u043e \u0432\u044b\u0432\u043e\u0434\u0438\u043c \u0442\u0435\u043ac\u0442 \u201cHello %name%\u201d, \u0438\u043d\u0430\u0447\u0435 \u201cHello stranger\u201d.<\/p>\n<p>  \u041a\u043b\u0430\u0441\u0441 fastcgi::Request \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0437\u0430 \u0437\u0430\u043f\u0440\u043e\u0441, \u0438 \u0437\u0430 \u043e\u0442\u0432\u0435\u0442, \u0445\u043e\u0442\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 2 \u043a\u043b\u0430\u0441\u0441\u0430 \u0438\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043a\u0430\u043a, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u0442\u043e\u043c \u0436\u0435 NodeJS.<br \/>  \u0423\u0436\u0435 \u201c\u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438\u201d \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c c cookies, \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u044b\u0435 HTTP-\u0441\u0442\u0430\u0442\u0443\u0441\u044b, \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u0442. \u043f. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u0436\u0435\u043d\u0442\u0435\u043b\u044c\u043c\u0435\u043d\u0441\u043a\u0438\u0439 \u043d\u0430\u0431\u043e\u0440 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0420\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0441\u0435\u0441\u0441\u0438\u0438, \u043d\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 2 \u0441\u0447\u0451\u0442\u0430. \u041e\u0431 \u044d\u0442\u043e\u043c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0440\u0430\u0437.<\/p>\n<p>  \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u0436\u0435 \u043a \u043d\u0430\u0448\u0438\u043c \u0431\u0430\u0440\u0430\u043d\u0430\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441 \u0432 shared-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<pre><code class=\"bash\">g++ HelloFastCGI.cpp -O2 -fPIC -lfastcgi-daemon2 -shared -o libHelloFastCGI.so <\/code><\/pre>\n<p>  \u0417\u0430\u0442\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b HelloFastCGI.conf (\u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u044b\u043b\u043e \u201cconf\u201d):<\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot;?&gt; &lt;fastcgi xmlns:xi=&quot;http:\/\/www.w3.org\/2001\/XInclude&quot;&gt; &lt;pools&gt;     &lt;pool name=&quot;main&quot; threads=&quot;1&quot; queue=&quot;5000&quot;\/&gt; &lt;\/pools&gt; &lt;handlers&gt;     &lt;handler pool=&quot;main&quot; url=&quot;\/hellofascgi&quot;&gt;         &lt;component name=&quot;HelloFastCGIComponent&quot;\/&gt;     &lt;\/handler&gt; &lt;\/handlers&gt; &lt;components&gt;     &lt;component name=&quot;HelloFastCGIComponent&quot; type=&quot;MainModule:HelloFastCGIFactory&quot;\/&gt;     &lt;component name=&quot;daemon-logger&quot; type=&quot;logger:logger&quot;&gt;        &lt;level&gt;INFO&lt;\/level&gt;        &lt;ident&gt;hellofastcgi&lt;\/ident&gt;     &lt;\/component&gt; &lt;\/components&gt; &lt;modules&gt;     &lt;module name=&quot;MainModule&quot; path=&quot;.\/libHelloFastCGI.so&quot;\/&gt;     &lt;module name=&quot;logger&quot; path=&quot;\/usr\/lib\/fastcgi2\/fastcgi2-syslog.so&quot;\/&gt; &lt;\/modules&gt; &lt;daemon&gt;     &lt;logger component=&quot;daemon-logger&quot;\/&gt;     &lt;endpoint&gt;         &lt;backlog&gt;128&lt;\/backlog&gt;         &lt;socket&gt;\/tmp\/fastcgi_daemon.sock&lt;\/socket&gt;         &lt;threads&gt;1&lt;\/threads&gt;     &lt;\/endpoint&gt;     &lt;pidfile&gt;\/var\/run\/fastcgi2\/HelloFastCGI.pid&lt;\/pidfile&gt;     &lt;monitor_port&gt;20012&lt;\/monitor_port&gt; &lt;\/daemon&gt; &lt;\/fastcgi&gt; <\/code><\/pre>\n<p>  \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a (handler) \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u043d\u0430 \u201c\/hellofastcgi\u201d (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"http:\/\/www.somedomain.com\/hellofastcgi\">www.somedomain.com\/hellofastcgi<\/a>). \u042d\u0442\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 HelloFastCGIComponent, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 MainModule. \u0422\u043e\u0447\u043d\u0435\u0435 \u0432 \u043c\u043e\u0434\u0443\u043b\u0435 \u043b\u0435\u0436\u0438\u0442 \u0444\u0430\u0431\u0440\u0438\u043a\u0430 HelloFastCGIFactory, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442. \u0412 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c MainModule \u0447\u0435\u0440\u043f\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0437 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 libHelloFastCGI.so. \u0422\u0430\u043a\u0436\u0435 \u0441\u0442\u043e\u0438\u0442 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0442\u044d\u0433\u0430 \u201csocket\u201d \u2014 \u044d\u0442\u043e \u043d\u0438 \u0447\u0442\u043e \u0438\u043d\u043e\u0435 \u043a\u0430\u043a unix-\u0441\u043e\u043a\u0435\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u043c \u0432\u0441\u043a\u043e\u0440\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445 nginx. \u201cpidfile\u201d \u2014 \u0432\u0430\u0436\u0435\u043d \u043f\u0440\u0438 \u0434\u0435\u043c\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 FastCGI-Daemon. \u0415\u0433\u043e \u0438\u043c\u044f \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c conf-\u0444\u0430\u0439\u043b\u0430, \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u0445. \u0427\u0442\u043e\u0431\u044b \u0434\u0435\u043c\u043e\u043d \u0431\u044b\u043b \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0434\u0435\u043b\u0430\u0442\u044c start\/stop\/restart, pid \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0435\u0436\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u201c\/var\/run\/fastcgi2\/\u201d.<\/p>\n<p>  \u0421\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0451 \u044d\u0442\u043e \u044f \u043f\u0440\u043e\u0434\u0435\u043b\u044b\u0432\u0430\u044e \u043d\u0430 \u0441\u0432\u0435\u0436\u0435\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u043e\u043c nginx, \u0442\u043e, \u043d\u0435 \u043c\u0443\u0434\u0440\u0441\u0442\u0432\u0443\u044f \u043b\u0443\u043a\u0430\u0432\u043e, \u043f\u0440\u0430\u0432\u043b\u044e \/etc\/nginx\/sites-available\/default. \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c:<\/p>\n<pre><code class=\"nginx\">server {   listen 80;    location \/ {     include fastcgi_params;     fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;     fastcgi_pass unix:\/tmp\/fastcgi_daemon.sock; } } <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c nginx<\/p>\n<pre><code class=\"bash\">sudo service nginx restart <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438<\/p>\n<pre><code class=\"bash\">fastcgi-daemon2 --config=HelloFastCGI.conf <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u043e\u0442\u043a\u0440\u044b\u0432 \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 <a href=\"http:\/\/localhost\/hellofastcgi\">localhost\/hellofastcgi<\/a>, \u0432\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c<\/p>\n<pre><code class=\"html\">Hello stranger <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <a href=\"http:\/\/localhost\/hellofastcgi?name=nick\">localhost\/hellofastcgi?name=nick<\/a> \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043c<\/p>\n<pre><code class=\"html\">Hello nick <\/code><\/pre>\n<p>  \u0423\u0440\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0443 \u0432\u0430\u0441 \u0442\u043e\u0436\u0435.<\/p>\n<p>  \u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0435\u0439\u0447\u0430\u0441 Fastcgi Daemon \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u0413\u0434\u0435-\u0436\u0435 \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u0430\u044f \u0434\u0435\u043c\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f? \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043d\u0438\u0436\u0435.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 daemon<\/h2>\n<p>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e Fastcgi Daemon \u043d\u0430 \u0442\u043e \u0438 Daemon, \u0447\u0442\u043e \u0435\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u043e \u0434\u0435\u043c\u043e\u043d\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u043f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0442\u0430\u0432\u0442\u043e\u043b\u043e\u0433\u0438\u044e).<\/p>\n<p>  \u0411\u0435\u0440\u0451\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 HelloFastCGI.conf, \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u043d\u0451\u043c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u043a libHelloFastCGI.so \u043d\u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u044b\u0439 \u0438 \u043a\u043b\u0430\u0434\u0451\u043c \u0432 \/etc\/fastcgi2\/available.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\/\u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\/\u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0434\u0435\u043c\u043e\u043d\u0430 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c:<\/p>\n<pre><code class=\"bash\">sudo service fascgi-daemon2 start\/stop\/restart &lt;appname&gt;\/all <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442<\/p>\n<pre><code class=\"bash\">sudo service fastcgi-daemon2 start HelloFastCGI <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0432 \/etc\/fastcgi2\/available \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e \u201call\u201d<\/p>\n<pre><code class=\"bash\">sudo service fastcgi-daemon2 start all <\/code><\/pre>\n<p>  \u041d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u044b\u043c \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u043e, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e.<\/p>\n<h2>\u0411\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0438<\/h2>\n<p>  \u041b\u044e\u0431\u043e\u043f\u044b\u0442\u0441\u0442\u0432\u0430 \u0440\u0430\u0434\u0438 \u0440\u0435\u0448\u0438\u043b \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c Fastcgi Daemon \u0438 NodeJS. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0431\u0440\u043e\u0441\u0430\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 JS:<\/p>\n<pre><code class=\"javascript\">var http = require('http'); var url = require('url');  http.createServer(function (req, res) { \tres.writeHead(200, {'Content-Type': 'text\/plain'}); \tvar query = url.parse(req.url, true).query; \tres.end('Hello ' + (query.name ? query.name : 'stranger'));  }).listen(1337, '127.0.0.1'); console.log('Server running at http:\/\/127.0.0.1:1337\/'); <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0447\u0438\u0441\u0442\u043e\u0442\u044b \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b proxy_pass \u0432 nginx \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 node.<br \/>  \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 Apache Bench:<\/p>\n<pre><code class=\"bash\">ab -c 100 -n 20000 http:\/\/IPorURL\/hellofastcgi?name=Nikolay <\/code><\/pre>\n<p>  \u0438<\/p>\n<pre><code class=\"bash\">ab -c 100 -n 20000 http:\/\/IPorURL\/?name=Nikolay <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<\/p>\n<p>  Fastcgi Daemon<\/p>\n<pre><code class=\"bash\">Concurrency Level:      100 Time taken for tests:   15.181 seconds Complete requests:      20000 Failed requests:        0 Write errors:           0 Non-2xx responses:      20000 Total transferred:      6460000 bytes HTML transferred:       3440000 bytes Requests per second:    1317.45 [#\/sec] (mean) Time per request:       75.904 [ms] (mean) Time per request:       0.759 [ms] (mean, across all concurrent requests) Transfer rate:          415.56 [Kbytes\/sec] received  Connection Times (ms)               min  mean[+\/-sd] median   max Connect:        0    0   0.5      0       4 Processing:    12   75  31.2     68     474 Waiting:        9   73  31.4     66     471 Total:         12   76  31.3     68     475  Percentage of the requests served within a certain time (ms)   50%     68   66%     80   75%     85   80%     88   90%     96   95%    106   98%    114   99%    125  100%    475 (longest request) <\/code><\/pre>\n<p>  NodeJS<\/p>\n<pre><code class=\"bash\">Concurrency Level:      100 Time taken for tests:   23.038 seconds Complete requests:      20000 Failed requests:        0 Write errors:           0 Total transferred:      2700000 bytes HTML transferred:       260000 bytes Requests per second:    868.12 [#\/sec] (mean) Time per request:       115.192 [ms] (mean) Time per request:       1.152 [ms] (mean, across all concurrent requests) Transfer rate:          114.45 [Kbytes\/sec] received  Connection Times (ms)               min  mean[+\/-sd] median   max Connect:        0    0   0.6      0      52 Processing:    39  114  21.7    109     306 Waiting:       28  112  21.5    107     305 Total:         40  115  21.7    109     306  Percentage of the requests served within a certain time (ms)   50%    109   66%    117   75%    125   80%    130   90%    145   95%    155   98%    168   99%    186  100%    306 (longest request) <\/code><\/pre>\n<p>  \u0421\u0442\u043e\u0438\u0442 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f \u043d\u0430 VirtualBox, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e \u043e\u0434\u043d\u043e \u044f\u0434\u0440\u043e \u043e\u0442 Core i7.<br \/>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0440\u0430\u0437\u0430 \u0432 \u043f\u043e\u043b\u044c\u0437\u0443 Fastcgi Daemon, \u0447\u0442\u043e, \u043a\u0430\u043a \u043c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043f\u043b\u043e\u0445\u043e \u0434\u043b\u044f NodeJS. \u0412\u043e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0443 NodeJS \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u043e \u0434\u043e 50%, \u0430 \u043f\u0430\u043c\u044f\u0442\u0438 \u2014 \u0434\u043e 45 M\u0411 (5.6 \u041c\u0411 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u043e\u043a\u043e\u044f). \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a Fastcgi Daemon \u043e\u0442\u044a\u0435\u0434\u0430\u043b \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 20% \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0438 9.5 \u041c\u0411 RAM (4.5 \u041c\u0411 \u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043f\u043e\u043a\u043e\u044f). \u0422\u043e \u0435\u0441\u0442\u044c \u043a \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u043e\u043b\u0435\u0435 \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u0435\u043d, \u0447\u0442\u043e \u043d\u0435\u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u042f\u0441\u043d\u043e\u0435 \u0434\u0435\u043b\u043e, \u0447\u0442\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u0444\u0435\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0432 \u0432\u0430\u043a\u0443\u0443\u043c\u0435. \u041f\u043e-\u0445\u043e\u0440\u043e\u0448\u0435\u043c\u0443, \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0411\u0414, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043e\u0431\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u041d\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438 \u044d\u0442\u043e\u0433\u043e \u0445\u0432\u0430\u0442\u0438\u0442.<\/p>\n<h2>\u0412\u043c\u0435\u0441\u0442\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f<\/h2>\n<p>  \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432\u044b\u0448\u0435\u043b \u0438\u0437 \u043d\u0435\u0434\u0440 \u042f\u043d\u0434\u0435\u043a\u0441\u0430. \u041f\u043e\u043c\u0438\u043c\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e Fastcgi Daemon \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 C++, \u0442\u0430\u043a \u0435\u0449\u0451 \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 init.d-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u043c\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u044f \u043e\u043f\u0438\u0448\u0443 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Fastcgi Daemon \u0441 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438, \u0411\u0414 \u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438. \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/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=\"http:\/\/habrahabr.ru\/post\/216181\/\"> http:\/\/habrahabr.ru\/post\/216181\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0430\u043a\u0438\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c \u043a\u0430\u043a NodeJS, \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0441\u0443\u0449\u0438\u0439 \u043f\u0443\u0441\u0442\u044f\u043a. \u0421\u043a\u0430\u0447\u0430\u043b \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a, \u0441\u0432\u0430\u044f\u043b js \u0432 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430 \u0438 \u043c\u043e\u0436\u043d\u043e \u0445\u0432\u0430\u0441\u0442\u0430\u0442\u044c\u0441\u044f. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c express \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u043e\u0443\u0442\u0438\u043d\u0433\u043e\u043c, \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438, \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043f\u0440\u0435\u043b\u0435\u0441\u0442\u044f\u043c\u0438. \u0422\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e \u0434\u0430\u0436\u0435 \u0441\u043a\u0443\u0447\u043d\u043e. \u0418 \u0441\u0442\u0430\u043b\u043e \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e: \u043a\u0430\u043a \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u0434\u0435\u043b\u0430 \u0443 \u043c\u043e\u0435\u0433\u043e \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u043e\u0433\u043e \u0421++, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u0436\u0435 5 \u043b\u0435\u0442 \u043d\u0435 \u0432\u0438\u0434\u0435\u043b\u0441\u044f. \u0412 \u0441\u0432\u043e\u0451 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0435\u043b\u044c\u0441\u0442\u0438\u043b \u043c\u0435\u043d\u044f ActionScript \u0438 \u043f\u0440\u043e\u0447\u0438\u0439 JavaScript, \u0430 \u043e \u0434\u043e\u0431\u0440\u043e\u043c \u0434\u0440\u0443\u0433\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0440\u0430\u0437 \u0432\u044b\u0440\u0443\u0447\u0430\u043b, \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u043e\u0437\u0430\u0431\u044b\u043b. \u0412 \u0441\u0432\u0435\u0442\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/yandex\/blog\/209324\/\">\u043d\u0435\u0434\u0430\u0432\u043d\u0438\u0445<\/a> <a href=\"http:\/\/habrahabr.ru\/company\/yandex\/blog\/214069\/\">\u0441\u0442\u0430\u0442\u0435\u0439<\/a> \u043e Configurable Omnipotent Custom Applications Integrated Network Engine (\u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043e Cocaine), \u043f\u043e\u043f\u0430\u043b\u0441\u044f \u043c\u043d\u0435 \u043d\u0430 \u0433\u043b\u0430\u0437\u0430 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c Fastcgi Daemon, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0438\u0440\u0443\u0435\u0442 HTTP-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Cocaine. \u0418 \u0442\u0430\u043a, \u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c  <\/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-216181","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/216181","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=216181"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/216181\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216181"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216181"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216181"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}