{"id":104,"date":"2024-10-09T19:10:03","date_gmt":"2024-10-09T12:10:03","guid":{"rendered":"https:\/\/megadump.ru\/?p=104"},"modified":"2024-12-22T15:41:49","modified_gmt":"2024-12-22T08:41:49","slug":"php-fpm-multiple-users","status":"publish","type":"post","link":"https:\/\/phpha.ru\/?p=104","title":{"rendered":"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 php-fpm \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439"},"content":{"rendered":"\n<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0437\u0430\u0432\u043e\u0434\u044f\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 (\u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u0441\u0430\u0439\u0442). \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 Ubuntu, \u043d\u043e \u043e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 Debian-based \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u0432. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 nginx, \u043d\u043e \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\"> # useradd -s \/bin\/bash -d \/home\/myuser\/ -m myuser <\/code><\/pre>\n\n\n\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 <strong>www-data<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\"># usermod -a -G myuser www-data<\/code><\/pre>\n\n\n\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c <strong>pool <\/strong>\u0432 <strong>php-fpm<\/strong> \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\"># cd \/etc\/php\/7.4\/fpm\/pool.d\n# cp www.conf mysite.conf\n# nano mysite.conf<\/code><\/pre>\n\n\n\n<p>\u0412 <strong>mysite.conf<\/strong> \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-ini\">[mysite]\n\n# ...\n\nuser = myuser\ngroup = myuser\n\nlisten.owner = myuser\nlisten.group = myuser\n\n# \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c socket \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0443\u0448\u0430\u0442\u044c php-fpm\nlisten = \/run\/php\/php7.4-fpm-mysite.sock\n\n# ...<\/code><\/pre>\n\n\n\n<p>\u0412 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441\u0430\u0439\u0442\u0430:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\">$ mkdir ~\/www<\/code><\/pre>\n\n\n\n<p>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0441\u0430\u043c \u0441\u0430\u0439\u0442 \u043d\u0430 <strong>nginx<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-nginx\">server {\n\n  # ...\n\n  root \/home\/myuser\/www;\n\n  # ...\n\n  location ~ \\.php$ {\n    include snippets\/fastcgi-php.conf;\n    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\n    # \u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c php-fpm \u0441\u043e\u043a\u0435\u0442\n    fastcgi_pass unix:\/run\/php\/php7.4-fpm-mysite.sock;\n  }\n\n  # ...\n}<\/code><\/pre>\n\n\n\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c <strong>php-fpm<\/strong> \u0438 <strong>nginx<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\"># service php7.4-fpm restart\n# service nginx restart<\/code><\/pre>\n\n\n\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0447\u0442\u043e <strong>php-fpm<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442 \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n\n\n\n<pre class=\"wp-block-prismatic-blocks\"><code class=\"language-shell-session\">$ ps -aux | grep php-fpm<\/code><\/pre>\n\n\n\n<p>\u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \u043a\u0430\u043a \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u0441\u0430\u0439\u0442\u0430 \u0432 <strong>nginx<\/strong>, \u043d\u0430\u0434\u0435\u044f\u0441\u044c \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u044d\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442.<\/p>\n\n\n\n<p>\u041f\u043e\u0437\u0434\u0440\u0430\u0432\u043b\u044f\u0435\u043c, \u0442\u0435\u043f\u0435\u0440\u044c <strong>php-fpm<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0430\u0439\u0442\u043e\u0432 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c \u0445\u043e\u0441\u0442\u0435 \u0437\u0430\u0432\u043e\u0434\u044f\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 (\u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0434 \u0441\u0432\u043e\u0439 \u0441\u0430\u0439\u0442). \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c. \u0412\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0432 Ubuntu, \u043d\u043e \u043e\u043d\u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 Debian-based \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u0432. \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043d &hellip; <a href=\"https:\/\/phpha.ru\/?p=104\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[18,15,16,17],"class_list":["post-104","post","type-post","status-publish","format-standard","hentry","category-web","tag-debian","tag-nginx","tag-php-fpm","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phpha.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=104"}],"version-history":[{"count":9,"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":113,"href":"https:\/\/phpha.ru\/index.php?rest_route=\/wp\/v2\/posts\/104\/revisions\/113"}],"wp:attachment":[{"href":"https:\/\/phpha.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phpha.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phpha.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}