{"id":1346,"date":"2011-07-22T14:02:13","date_gmt":"2011-07-22T11:02:13","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=1346"},"modified":"2022-04-06T10:56:06","modified_gmt":"2022-04-06T07:56:06","slug":"nginxphpphp-fpmperlfcgiwrap","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=1346","title":{"rendered":"[nginx] \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 web \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 nginx"},"content":{"rendered":"<p>\u0412 \u0441\u0438\u043b\u0443 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 <strong>web<\/strong>-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 <strong>nginx<\/strong> \u0438 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0443\u0436\u0435 \u0440\u0435\u043b\u0438\u0437\u0430 <strong>1.0<\/strong> \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 <strong>nginx<\/strong>. \u041d\u043e \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b<strong> web<\/strong>-\u0441\u0430\u0439\u0442\u0430 \u043e\u0434\u043d\u043e\u0433\u043e <strong>nginx&#8217;a<\/strong> \u043d\u0430\u043c \u043c\u0430\u043b\u043e. \u041d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <strong>php\/cgi<\/strong> \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u041e\u0431 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0447\u044c \u0438 \u043f\u043e\u0439\u0434\u0451\u0442 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n<p><!--more--><\/p>\n<p><strong><em><span style=\"color: #008000;\">\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0441\u0442\u0435\u043d\u0434:<\/span><\/em><\/strong> <strong>FreeBSD 8.1-RELEASE i386<\/strong><\/p>\n<p><strong><span style=\"color: #ff0000;\">1) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 nginx (\u0432\u0435\u0440\u0441\u0438\u044f 1.05).<\/span><\/strong><\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0443\u0434\u0435\u043c \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432:<\/p>\n<p><code>#cd \/usr\/ports\/www\/nginx &amp;&amp; make install clean<\/code><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0446\u0438\u0439 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u0438\u0435:<\/p>\n<p><code>[X] HTTP_MODULE &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Enable HTTP module<br \/>\n[X] HTTP_CACHE_MODULE &nbsp; &nbsp; &nbsp; &nbsp; Enable http_cache module<br \/>\n[X] HTTP_REWRITE_MODULE &nbsp; &nbsp; &nbsp; Enable http_rewrite module<br \/>\n[X] HTTP_STATUS_MODULE &nbsp; &nbsp; &nbsp; &nbsp;Enable http_stub_status module<\/code><\/p>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430. \u041f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>\/usr\/local\/etc\/nginx\/nginx.conf<\/strong> \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<p><code><br \/>\n#\u0427\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u044b\u0445 \u044f\u0434\u0435\u0440<br \/>\nworker_processes 4;<\/code><\/p>\n<p><code>#\u0423\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 gettimeofday()<br \/>\ntime_resolution 100ms;<\/code><\/p>\n<p><code>error_log \/var\/log\/nginx\/error.log;<\/code><\/p>\n<p><code>events {<br \/>\nworker_connections 10240;<br \/>\nuse kqueue; # FreeBSD only<br \/>\nmulti_accept on;<br \/>\n}<\/code><\/p>\n<p><code>http {<br \/>\ninclude mime.types;<br \/>\ndefault_type application\/octet-stream;<br \/>\nlog_format main '$remote_addr - $remote_user [$time_local] \"$request\" ''$status $body_bytes_sent \"$http_referer\" ''\"$http_user_agent\" \"$http_x_forwarded_for\"';<br \/>\naccess_log \/var\/log\/nginx\/access.log main;<\/code><\/p>\n<p><code>sendfile off;<br \/>\ntcp_nopush on;<br \/>\ntcp_nodelay on;<br \/>\nkeepalive_timeout 65;<br \/>\nreset_timedout_connection on;<br \/>\nserver_tokens off;<br \/>\n<\/code><\/p>\n<p><code>client_body_buffer_size 1K;<br \/>\nclient_header_buffer_size 1k;<br \/>\nclient_max_body_size 1k;<br \/>\nlarge_client_header_buffers 2 1k;<br \/>\nclient_body_timeout 10;<br \/>\nclient_header_timeout 10;<br \/>\nsend_timeout 10;<br \/>\n<\/code><\/p>\n<p><code>gzip on;<br \/>\ngzip_min_length 1000;<br \/>\ngzip_buffers 16 8k;<br \/>\ngzip_types text\/plain text\/css text\/xml application\/x-javascript application\/xml application\/xhtml+xml;<br \/>\n<\/code><br \/>\n<code>server {<br \/>\nlisten 80 default&nbsp;sndbuf=16k rcvbuf=8k accept_filter=httpready;<br \/>\nserver_name _;<\/code><\/p>\n<p><code>location \/ {<br \/>\nroot \/usr\/local\/www\/nginx;<br \/>\nindex index.html index.htm;<br \/>\n}<\/code><\/p>\n<p><code>#restrict all \".files\" (.htpasswd, .git,...)<br \/>\nlocation ~ \/\\. {<br \/>\ndeny all;<br \/>\naccess_log off;<br \/>\nlog_not_found off;<br \/>\n}<\/code><\/p>\n<p><code>error_page 500 502 503 504 \/50x.html;<br \/>\nlocation = \/50x.html {<br \/>\nroot \/usr\/local\/www\/nginx-dist;<br \/>\n}<br \/>\n}<\/code><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/span><\/strong><\/em><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">1)<\/span><\/strong><\/em> \u041f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0445 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0441 \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e\u00ad\u0441\u0442\u044c\u044e, \u0438\u043d\u0430\u0447\u0435 \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e &#8220;\u0437\u0430\u0434\u0430\u0432\u0438\u0442\u044c&#8221; \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b,&nbsp;\u0432\u043a\u043b\u044e\u0447\u0430\u044f&nbsp;<strong>memcached<\/strong> \u0438&nbsp;\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u043b\u0443\u0447\u0448\u0435&nbsp;\u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443&nbsp;<strong>nginx<\/strong> \u0441 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u043c\u0438&nbsp;\u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438 \u0438 \u043b\u0438\u0448\u044c&nbsp;\u0437\u0430\u0442\u0435\u043c \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043c.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">2)<\/span><\/strong><\/em> \u041e\u043f\u0446\u0438\u044f <strong>use kqueue<\/strong> \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 <strong>nginx<\/strong> \u0432\u043e <strong>F\u0433eeBSD<\/strong> \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 <strong>kqueue<\/strong> \u0432\u043c\u0435\u0441\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043c\u0435\u0434\u00ad\u043b\u0435\u043d\u043d\u043e\u0433\u043e <strong>epoll<\/strong>.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">3)<\/span><\/strong><\/em> \u0421\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <strong>sendfile()<\/strong> \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0435\u0434\u0438\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0433\u043e \u0446\u0435\u043b\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043e\u043a\u0435\u0442. \u041c\u0435\u0442\u043e\u0434 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u043d\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0435\u0441\u043b\u0438 \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0441\u043d\u0430\u0449\u0435\u043d \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u041e\u0417\u0423, <strong>sendfile()<\/strong> \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b\u043d\u0443\u0434\u0438\u0442 <strong>nginx<\/strong> \u0447\u0430\u0441\u0442\u043e \u0441\u0432\u043e\u043f\u0438\u0442\u044c\u0441\u044f \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0437\u0430\u00ad\u043c\u0435\u0434\u043b\u0438\u0442 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>\u0415\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442<br \/>\n\u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c. <strong>aio<\/strong> \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430<br \/>\n\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u044b \u043c\u0430\u043b\u043e, \u0430 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 &#8211; \u043c\u043d\u043e\u0433\u043e.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">4)<\/span><\/strong><\/em> \u041en\u0446\u0438\u044f <strong>tcp_nopush<\/strong> \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <strong>nginx<\/strong> \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c <strong>\u041d\u0422\u0422\u0420<\/strong>-\u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043f\u0430\u043a\u0435\u0442\u0435, \u043d\u043e \u043e\u043d\u0430 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0431\u0435\u0437 <strong>sendfile<\/strong>.<\/p>\n<p><em><strong><span style=\"color: #ff6600;\">5)<\/span><\/strong><\/em> <strong>GZI\u0420<\/strong>-\u043a\u043e\u043c\u043f\u0440\u0435\u0441\u0441\u0438\u044f \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u0430\u043a\u0430\u044f \u043a\u043e\u043cn\u0440\u0435\u0441\u0441\u0438\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043c \u043f\u0435\u0440\u0435\u00ad\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0443\u0441\u043f\u0435\u0442\u044c&nbsp;\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0437\u0430n\u0440\u043e\u0441\u043e\u0432, \u0441 \u0434\u0440\u0443\u0433\u043e\u0439 &#8211; \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0440\u044f\u043c\u043e n\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u043c\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u043e\u0447\u043d\u043e \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c, \u043d\u0443\u0436\u043d\u0430 \u043b\u0438 \u043e\u043d\u0430 \u0442\u0435\u0431\u0435, \u043c\u043e\u0436\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u044d\u043a\u0441\u043f\u0435\u00ad\u0440\u0438\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0443\u0442\u0435\u043c, \u043f\u0440\u0438\u0447\u0435\u043c \u044d\u043a\u0441n\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u043e\u0434 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u043e\u0439.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <strong>nginx&#8217;a<\/strong> \u0432 <strong>\/etc\/rc.conf<\/strong>:<\/p>\n<p><code>#echo 'nginx_enable=\"YES\"' &gt;&gt; \/etc\/rc.conf'<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c <strong>nginx<\/strong> \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/nginx start<br \/>\n#sockstat | grep nginx<br \/>\nwww nginx 51589 6 tcp4 *:80 *:*<br \/>\nwww nginx 51589 10 stream -&gt; ??<br \/>\nroot nginx 45280 6 tcp4 *:80 *:*<br \/>\nroot nginx 45280 9 stream -&gt; ??<br \/>\nroot nginx 45280 10 stream -&gt; ??<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">2) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 php (\u0432\u0435\u0440\u0441\u0438\u044f 5.3.6_1)<\/span><\/strong><\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 <strong>5.3<\/strong> \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430<strong> fpm<\/strong> \u0443\u0436\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u044f\u0434\u0440\u0435<strong> php<\/strong>. \u0414\u043b\u044f \u0432\u0435\u0440\u0441\u0438\u0438 <strong>5.2<\/strong> \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u0447\u0430\u0442\u044c \u043f\u0430\u0442\u0447.<\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432:<\/p>\n<p><code>#cd \/usr\/ports\/lang\/php5 &amp;&amp; make install clean<\/code><\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0446\u0438\u0439 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u0438\u0435:<\/p>\n<p><code>[X] CLI &nbsp; &nbsp; &nbsp; &nbsp;Build CLI version<br \/>\n[X] CGI &nbsp; &nbsp; &nbsp; &nbsp;Build CGI version<br \/>\n[X] FPM &nbsp; &nbsp; &nbsp; &nbsp;Build FPM version (experimental)<br \/>\n[X] SUHOSIN &nbsp; &nbsp;Enable Suhosin protection system<br \/>\n<\/code><br \/>\n\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>\/usr\/local\/etc\/php-fpm.conf<\/strong> \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<p><code>[global]<br \/>\npid = run\/php-fpm.pid<br \/>\nerror_log = log\/php-fpm.log<br \/>\nlog_level = notice<br \/>\n[www]<br \/>\nlisten = \/tmp\/php-fpm.sock<br \/>\nuser = www<br \/>\ngroup = www<br \/>\npm = dynamic<br \/>\npm.max_children = 50<br \/>\npm.start_servers = 20<br \/>\npm.min_spare_servers = 5<br \/>\npm.max_spare_servers = 35<\/code><\/p>\n<p>\u0433\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <strong>pid<\/strong> \u0438<strong> error_log<\/strong> \u0438\u043c\u0435\u044e\u0442 \u043f\u0443\u0442\u044c \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <strong>\/var<\/strong><\/p>\n<p><em><strong><span style=\"color: #ff6600;\">\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435:<\/span><\/strong><\/em><\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <strong>virtualhosts<\/strong>, \u0442\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0430\u0439\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0443\u043b, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p><code>[global]<br \/>\n...<br \/>\n[site1]<br \/>\nuser=site1<br \/>\ngroup=www<br \/>\nlisten=\/tmp\/php-fpm_site1.sock<br \/>\n...<br \/>\n[site2]<br \/>\nuser=site2<br \/>\ngroup=www<br \/>\nlisten=\/tmp\/php-fpm_site2.sock<br \/>\n...<\/code><\/p>\n<p>\u042d\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0441\u0430\u0439\u0442\u043e\u0432 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 <strong>nginx&#8217;a<\/strong> \u0432 <strong>\/etc\/rc.conf<\/strong>:<\/p>\n<p><code>#echo 'php_fpm_enable=\"YES\"'&nbsp;&gt;&gt; \/etc\/rc.conf'<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c <strong>php_fpm<\/strong> \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/php-fpm start<br \/>\n#sockstat | grep php-fpm<br \/>\nwww php-fpm 45316 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45315 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45314 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45313 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45312 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45311 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45310 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45309 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45308 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45307 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45306 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45305 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45304 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45303 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45302 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45301 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45300 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45299 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45298 0 stream \/tmp\/php-fpm.sock<br \/>\nwww php-fpm 45297 0 stream \/tmp\/php-fpm.sock<br \/>\nroot php-fpm 45296 4 stream -&gt; ??<br \/>\nroot php-fpm 45296 5 stream -&gt; ??<br \/>\nroot php-fpm 45296 6 stream \/tmp\/php-fpm.sock<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <strong>nginx&#8217;a<\/strong> \u0442\u0430\u043a, \u0447\u0442\u043e \u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <strong>php<\/strong>-\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043e\u043d \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u043b \u0441\u043e\u043a\u0435\u0442\u0443 <strong>\/tmp\/php-fpm.sock<\/strong>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0432 \u0444\u0430\u0439\u043b<strong> nginx.conf<\/strong>, \u0432 \u0441\u0435\u043a\u0446\u0438\u044e server :<\/p>\n<p><code>server {<br \/>\n...<br \/>\nlocation ~ \\.php$ {<br \/>\nroot \/usr\/local\/www\/nginx;<br \/>\nfastcgi_pass unix:\/tmp\/php-fpm.sock;<br \/>\nfastcgi_index index.php;<br \/>\nfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br \/>\ninclude \/usr\/local\/etc\/nginx\/fastcgi_params;<br \/>\n}<br \/>\n...<\/code><\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u0432 \u0431\u043b\u043e\u043a\u0435<strong> &#8216;location \/ {&#8216;<\/strong> \u043c\u0435\u043d\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443<\/p>\n<p><code>index &nbsp;index.html index.htm;<\/code><\/p>\n<p>\u043d\u0430 \u0442\u0430\u043a\u0443\u044e<\/p>\n<p><code>index &nbsp;index.php index.html index.htm;<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0448 \u043a\u043e\u0440\u0435\u043d\u0435\u0432\u043e\u0439 \u0441\u0430\u0439\u0442 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <strong>php<\/strong>-\u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0430\u043b\u0438\u0430\u0441 \u0438 \u0447\u0442\u043e \u0431\u044b \u0432 \u043d\u0451\u043c \u0442\u043e\u0436\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u043b\u0438\u0441\u044c <strong>php<\/strong>-\u0441\u043a\u0440\u0438\u043f\u0442\u044b? \u0422\u043e\u0433\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0431\u043b\u043e\u043a\u0438:<\/p>\n<p><code>location \/cacti {<br \/>\nalias \/usr\/local\/www\/cacti;<br \/>\nindex index.php;<br \/>\n}<\/code><\/p>\n<p><code>location ~ ^\/cacti\/(.*\\.php)$ {<br \/>\nfastcgi_index index.php;<br \/>\nfastcgi_param SCRIPT_FILENAME \/usr\/local\/www\/cacti\/$1;<br \/>\nfastcgi_param DOCUMENT_ROOT \/usr\/local\/www\/cacti;<br \/>\nfastcgi_pass unix:\/tmp\/php-fpm.sock;<br \/>\ninclude \/usr\/local\/etc\/nginx\/fastcgi_params;<br \/>\n}<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 <strong>nginx&#8217;a<\/strong> \u0438 \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u043e\u0439:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/nginx reload<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">3) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 perl&#8217;a.<\/span><\/strong><\/p>\n<p>\u041f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <strong>perl<\/strong> \u0443 \u0432\u0430\u0441 \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e\u0433\u0434\u0430 \u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0432\u0435\u0440\u0441\u0438\u044e <strong>5.14<\/strong> \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432.<\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c<strong> perl<\/strong>-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u044b \u0442\u043e\u0436\u0435 \u0431\u0443\u0434\u0435\u043c \u0447\u0435\u0440\u0435\u0437<strong> FastCGI<\/strong>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u044b \u0432\u044b\u0431\u0440\u0430\u043b\u0438 <strong>fcgiwrap<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0432 \u043f\u043e\u0440\u0442\u0430\u0445. \u0421\u0442\u0430\u0432\u0438\u043c \u0435\u0433\u043e:<\/p>\n<p><code>#cd \/usr\/ports\/www\/fcgiwrap &amp;&amp; make install clean<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <strong>\/etc\/rc.conf<\/strong>:<\/p>\n<p><code>fcgiwrap_enable=\"YES\"<br \/>\nfcgiwrap_socket=\"unix:\/var\/run\/fcgiwrap\/fcgiwrap.sock\"<br \/>\nfcgiwrap_user=\"www\"<\/code><\/p>\n<p>\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/fcgiwrap start<br \/>\n#sockstat | grep fcgiwrap<br \/>\nwww fcgiwrap 52145 0 stream \/var\/run\/fcgiwrap\/fcgiwrap.sock<\/code><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c <strong>nginx&#8217;a<\/strong>. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0430\u043a\u0438\u0439 \u0431\u043b\u043e\u043a \u0432 \u0441\u0435\u043a\u0446\u0438\u044e <strong>server<\/strong>:<\/p>\n<p><code>location \/cgi-bin2 {<br \/>\nalias \/usr\/local\/www\/cgi-bin2;<br \/>\nfastcgi_pass unix:\/var\/run\/fcgiwrap\/fcgiwrap.sock;<br \/>\nfastcgi_param SCRIPT_FILENAME \/usr\/local\/www$fastcgi_script_name;<br \/>\nfastcgi_param SCRIPT_NAME \/usr\/local\/www$fastcgi_script_name;<br \/>\ninclude \/usr\/local\/etc\/nginx\/fastcgi_params;<br \/>\n}<\/code><\/p>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 <strong>nginx&#8217;a<\/strong> \u0438 \u0440\u0430\u0434\u0443\u0435\u043c\u0441\u044f:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/nginx reload<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">4) \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 eAccelerator (\u0432\u0435\u0440\u0441\u0438\u044f 0.9.6.1_1)<\/span><\/strong><\/p>\n<p><strong>eAccelerator<\/strong> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>PHP<\/strong>-\u0430\u043a\u0441\u0435\u043b\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c, \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430. \u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, <strong>PHP<\/strong> \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0441\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0438\u0445 \u0432 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0439 \u043a\u043e\u0434, \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0435\u0442\u0441\u044f. \u0417\u0430\u0434\u0430\u0447\u0430 <strong>eAccelerator<\/strong> \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0438 \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f, \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044f \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u0430.<\/p>\n<p><strong><em><span style=\"color: #ff6600;\">\u0412\u043d\u0438\u043c\u0430\u043d\u0438\u0435!<\/span><\/em> eAccelerator<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 <strong>PHP<\/strong> \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 <strong>fastcgi<\/strong> \u0438\u043b\u0438 <strong>mod_php<\/strong>.<\/p>\n<p>\u0421\u0442\u0430\u0432\u0438\u043c \u0438\u0437 \u043f\u043e\u0440\u0442\u043e\u0432:<\/p>\n<p><code>#cd \/usr\/ports\/www\/eaccelerator&nbsp;&amp;&amp; make install clean<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0444\u0430\u0439\u043b <strong>php.ini<\/strong> \u0438 \u0432\u043d\u043e\u0441\u0438\u043c \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<p><code>extension=\"eaccelerator.so\"<br \/>\neaccelerator.shm_size=\"32\"<br \/>\neaccelerator.cache_dir=\"\/var\/spool\/eaccelerator\"<br \/>\neaccelerator.enable=\"1\"<br \/>\neaccelerator.optimizer=\"1\"<br \/>\neaccelerator.check_mtime=\"1\"<br \/>\neaccelerator.debug=\"0\"<br \/>\neaccelerator.filter=\"\"<br \/>\neaccelerator.shm_max=\"0\"<br \/>\neaccelerator.shm_ttl=\"3600\"<br \/>\neaccelerator.shm_prune_period=\"1800\"<br \/>\neaccelerator.shm_only=\"0\"<br \/>\neaccelerator.compress=\"1\"<br \/>\neaccelerator.compress_level=\"9\"<br \/>\n<\/code><br \/>\n\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0434\u043b\u044f \u043a\u044d\u0448\u0430 \u0438 \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0430:<\/p>\n<p><code>#mkdir \/var\/spool\/eaccelerator<br \/>\n#chmod 0700 \/var\/spool\/eaccelerator<br \/>\n#chown www \/var\/spool\/eaccelerator<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c <strong>php-fpm<\/strong>:<\/p>\n<p><code>#\/usr\/local\/etc\/rc.d\/php-fpm reload<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">5) Accept-\u0444\u0438\u043b\u044c\u0442\u0440\u044b.<\/span><\/strong><\/p>\n<p>\u0412 2000-\u043e\u043c \u0433\u043e\u0434\u0443 <strong>FreeBSD<\/strong> \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c <strong>accept<\/strong>-\u0444\u0438\u043b\u044c\u0442\u0440\u044b. \u041e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0432 <strong>accept()<\/strong> \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0435\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043f\u0440\u0438\u0434\u0451\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0441 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 (\u0444\u0438\u043b\u044c\u0442\u0440 <strong>dataready<\/strong>) \u0438\u043b\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a <strong>HTTP<\/strong>-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 (\u0444\u0438\u043b\u044c\u0442\u0440 <strong>httpready<\/strong>). \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u0432 <strong>Apache<\/strong> (\u0430 \u0432 \u043d\u0451\u043c \u043e\u043d\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0432\u0435\u0440\u0441\u0438\u0438 <strong>1.3.14<\/strong>) \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0432. \u0412 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 <strong>select()<\/strong>, <strong>poll()<\/strong> \u0438\u043b\u0438 <strong>kqueue()<\/strong>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <strong>thttpd-2.22<\/strong>, \u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445<strong> accept<\/strong>-\u0444\u0438\u043b\u044c\u0442\u0440\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. (<em>\u0412\u0437\u044f\u0442\u043e \u0441 \u0441\u0430\u0439\u0442\u0430 \u0418\u0433\u043e\u0440\u044f \u0421\u044b\u0441\u043e\u0435\u0432\u0430<\/em>)<\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043e\u043d\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0443\u0441\u043a\u043e\u0440\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 <strong>nginx&#8217;a<\/strong>. \u0417\u0430\u043c\u0435\u0447\u0443, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e <strong>FreeBSD<\/strong>. \u0418 \u0442\u0430\u043a, \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0440\u0430\u0442\u044c \u044f\u0434\u0440\u043e \u0441 \u043e\u043f\u0446\u0438\u044f\u043c\u0438<\/p>\n<p><code>options ACCEPT_FILTER_HTTP<br \/>\noptions ACCEPT_FILTER_DATA<\/code><\/p>\n<p>\u041b\u0438\u0431\u043e \u043e\u0434\u043d\u0443 \u0438\u0437 \u043d\u0438\u0445, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a\u043e\u0439 \u0444\u0438\u043b\u044c\u0442\u0440 \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0435\u0440\u0435\u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u044f\u0434\u0440\u043e, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<p><code>#kldload accf_http<br \/>\n#kldload accf_data<br \/>\n<\/code><br \/>\n\u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <strong>\/boot\/loader.conf<\/strong>:<\/p>\n<p><code>accf_http_load=YES<br \/>\naccf_data_load=YES<\/code><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 <strong>nginx&#8217;a<\/strong>. \u0412\u043e\u0442 \u043a\u0430\u043a\u043e\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430 \u044d\u0442\u043e \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442:<\/p>\n<blockquote><p><span style=\"color: #993366;\">accept_filter=\u0444\u0438\u043b\u044c\u0442\u0440&nbsp;\u2014 \u0437\u0430\u0434\u0430\u0451\u0442 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 accept-\u0444\u0438\u043b\u044c\u0442\u0440\u0430. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 FreeBSD, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0430 \u0444\u0438\u043b\u044c\u0442\u0440\u0430&nbsp;\u2014 dataready \u0438 httpready. \u041f\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0443 -HUP accept-\u0444\u0438\u043b\u044c\u0442\u0440 \u043c\u043e\u0436\u043d\u043e \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 FreeBSD, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 6.0, 5.4-STABLE \u0438 4.11-STABLE.<\/span><\/p><\/blockquote>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 <strong>nginx.conf<\/strong>:<\/p>\n<p><code>listen 1.2.3.4:80 default sndbuf=16k rcvbuf=8k accept_filter=httpready;<\/code><\/p>\n<p><strong><span style=\"color: #ff0000;\">6) \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u0435\u0441\u0441\u0438\u044f\u043c\u0438 php.<\/span><\/strong><\/p>\n<p>\u041f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0441\u0435\u0441\u0441\u0438\u0439 \u0432 <strong>php<\/strong>, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 <strong>\/tmp<\/strong> \u0438 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0437\u0430\u0431\u0438\u0432\u0430\u044e\u0442 \u0440\u0430\u0437\u0434\u0435\u043b. \u0427\u0442\u043e \u0431\u044b \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p><em><span style=\"color: #ff6600;\">&#8211; \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0443\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0441\u0435\u0441\u0441\u0438\u0439 (\u0432 php.ini \u043c\u0435\u043d\u044f\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 session.save_path = &#8220;\/var\/lib\/php5&#8221; \u043d\u0443 \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0430\u043f\u043a\u0443, \u0433\u0434\u0435 \u043c\u0435\u0441\u0442\u0430 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e)<\/span><\/em><br \/>\n<em><span style=\"color: #ff6600;\"> &#8211; \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445&nbsp;session.gc_probability \u0438 session.gc_divisor, \u0447\u0442\u043e \u0431\u044b \u0434\u0440\u043e\u0431\u044c session.gc_probability\/session.gc_divisor \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430 \u0438 \u0438\u043c\u0435\u043b\u0430 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/span><\/em><br \/>\n<em><span style=\"color: #ff6600;\"> &#8211; \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u043e \u043a\u0440\u043e\u043d\u0443 \u0441\u0431\u043e\u0440\u0449\u0438\u043a \u043c\u0443\u0441\u043e\u0440\u0430 (garbage collector). \u041f\u0440\u0438\u043c\u0435\u0440 \u0434\u043b\u044f debian&#8217;a<\/span><\/em><\/p>\n<p><code>09,39 * * * * root [ -x \/usr\/lib\/php5\/maxlifetime ] &amp;&amp; [ -d \/var\/lib\/php5 ] &amp;&amp; find \/var\/lib\/php5\/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(\/usr\/lib\/php5\/maxlifetime) ! -execdir fuser -s {} 2&gt;\/dev\/null \\; -delete<\/code><\/p>\n<p><strong><span style=\"color: #ff6600;\"><em><span style=\"color: #ff6600;\">\u041b\u043e\u0436\u043a\u0430 \u0434\u0451\u0433\u0442\u044f.<\/span><\/em><\/span><\/strong><\/p>\n<p>\u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430 \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u0432 \u043f\u043e\u044f\u0432\u043b\u044f\u043b\u0430\u0441\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043b\u043e\u0433\u0430\u0445<strong> php-fpm<\/strong>:<\/p>\n<p><code>[28-Jul-2011 12:36:28] WARNING: [pool www] child 2273 exited on signal 11 (SIGSEGV) after 2172.202986 seconds from start<br \/>\n[28-Jul-2011 12:36:28] NOTICE: [pool www] child 12535 started<br \/>\n[28-Jul-2011 12:36:35] WARNING: [pool www] child 2266 exited on signal 11 (SIGSEGV) after 2178.624133 seconds from start<br \/>\n[28-Jul-2011 12:36:35] NOTICE: [pool www] child 12552 started<\/code><\/p>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c <strong>php<\/strong>-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u0440\u0430\u0437: \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0430\u0437 &#8211; \u043f\u0438\u0448\u0435\u0442 \u0421\u0435\u0440\u0432\u0438\u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d. \u041d\u0443 \u0438 \u043a\u043e\u0433\u0434\u0430 \u043f\u0438\u0441\u0430\u043b\u043e\u0441\u044c &#8220;\u0421\u0435\u0440\u0432\u0438\u0441 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d&#8221;, \u0442\u043e \u0432 \u043b\u043e\u0433\u0430\u0445 \u043a\u0430\u043a \u0440\u0430\u0437 \u0441\u0432\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u0437\u0430\u0432\u0435\u0442\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<p>\u041a\u0430\u043a \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043b\u0435\u0447\u0435\u043d\u0438\u044f, \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0442\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443<\/p>\n<p><code>fastcgi_param PHP_ADMIN_VALUE \"open_basedir=\/usr\/local\/share\/cacti\/:\/var\/tmp\/\";<\/code><\/p>\n<p>\u043a \u0431\u043b\u043e\u043a\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f<strong> fastcgi <\/strong>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0437 <strong>location&#8217;\u043e\u0432<\/strong> (\u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0434\u043b\u044f <strong>location&#8217;\u0430<\/strong> <strong>cacti<\/strong>). \u041c\u043e\u0436\u0435\u0442 \u044d\u0442\u043e \u0431\u044b\u0442\u044c \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <strong>open_basedir<\/strong> \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438<strong> location&#8217;a nagios<\/strong>. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0451 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c.<\/p>\n<p>7) \u0421\u0441\u044b\u043b\u043a\u0438<\/p>\n<p>https:\/\/habrahabr.ru\/post\/260669\/<\/p>\n<p>https:\/\/www.packtpub.com\/books\/content\/fine-tune-nginx-configufine-tune-nginx-configurationfine-tune-nginx-configurationratio<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u0441\u0438\u043b\u0443 \u0432\u0441\u0451 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u0438 web-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 nginx \u0438 \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0443\u0436\u0435 \u0440\u0435\u043b\u0438\u0437\u0430 1.0 \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 nginx. \u041d\u043e \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b web-\u0441\u0430\u0439\u0442\u0430 \u043e\u0434\u043d\u043e\u0433\u043e nginx&#8217;a \u043d\u0430\u043c \u043c\u0430\u043b\u043e. \u041d\u0443\u0436\u043d\u043e \u0435\u0449\u0451 \u0437\u0430\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c php\/cgi \u0441\u043a\u0440\u0438\u043f\u0442\u044b. \u041e\u0431 \u044d\u0442\u043e\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0435\u0447\u044c \u0438 \u043f\u043e\u0439\u0434\u0451\u0442 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,15],"tags":[],"class_list":["post-1346","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-www"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1346"}],"version-history":[{"count":33,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1346\/revisions"}],"predecessor-version":[{"id":5898,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/1346\/revisions\/5898"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}