{"id":30190,"date":"2022-11-25T11:53:00","date_gmt":"2023-08-10T05:39:33","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/"},"modified":"2025-08-12T18:00:24","modified_gmt":"2025-08-12T10:00:24","slug":"%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/","title":{"rendered":"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp"},"content":{"rendered":"<ul class=\"post-ul\">ubuntu 16.04 \u306b\u3066\u5b9f\u65bd<\/ul>\n<h2>\u5b89\u88c5<\/h2>\n<pre class=\"post-pre\"><code>apt-get install -y \\\r\n    nginx php-fpm\r\n<\/code><\/pre>\n<h2>\u786e\u8ba4php-fpm\u670d\u52a1\u662f\u5426\u6b63\u5e38\u3002<\/h2>\n<pre class=\"post-pre\"><code>systemctl status php7.0-fpm\r\n<\/code><\/pre>\n<ul class=\"post-ul\">running, enabled \u3092\u78ba\u8a8d\u3002<\/ul>\n<h2>\u63d2\u5ea7 (ch\u0101 zu\u00f2)<\/h2>\n<p>\/etc\/php\/7.0\/fpm\/pool.d\/www.conf \u306bsocket\u306e\u8a18\u8ff0\u3042\u308a<\/p>\n<pre class=\"post-pre\"><code>$ ls -l \/run\/php\/php7.0-fpm.sock\r\nsrw-rw---- 1 www-data www-data 0  4\u6708 15 09:51 \/run\/php\/php7.0-fpm.sock\r\n<\/code><\/pre>\n<h2>\u8ba9nginx\u652f\u6301php\u3002<\/h2>\n<pre class=\"post-pre\"><code><span class=\"gd\">-       index index.html index.htm index.nginx-debian.html;\r\n<\/span><span class=\"gi\">+       index index.html index.htm index.nginx-debian.html index.php;\r\n<\/span><\/code><\/pre>\n<pre class=\"post-pre\"><code><span class=\"gi\">+       location ~ \\.php$ {\r\n+              include snippets\/fastcgi-php.conf;\r\n+       \r\n<\/span>        #       # With php7.0-cgi alone:\r\n        #       fastcgi_pass 127.0.0.1:9000;\r\n<span class=\"gi\">+              # With php7.0-fpm:\r\n+              fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n+       }\r\n<\/span><\/code><\/pre>\n<p>\u5982\u679c\u662fdebian9 + php7\u7684\u60c5\u51b5\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"gd\">-   #   fastcgi_pass unix:\/var\/run\/php5-fpm.sock;\r\n<\/span><span class=\"gi\">+       fastcgi_pass unix:\/run\/php\/php7.0-fpm.sock;\r\n<\/span><\/code><\/pre>\n<h2>\u786e\u8ba4\u884c\u52a8<\/h2>\n<ul class=\"post-ul\">document_root : \/var\/www\/html\/<\/ul>\n<pre class=\"post-pre\"><code><span class=\"cp\">&lt;?php<\/span>\r\n<span class=\"k\">echo<\/span> <span class=\"s2\">\"hoge\"<\/span><span class=\"p\">;<\/span>\r\n<\/code><\/pre>\n<ul class=\"post-ul\">http:\/\/localhost\/a.php<\/ul>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d060837434c4406bdaadd\/18-0.png\" alt=\"hge.png\" \/><\/div>\n<ul class=\"post-ul\">\u30ed\u30b0\u306f \/var\/log\/php7.0-fpm.log \u306b\u51fa\u529b\u3055\u308c\u308b(?)<\/ul>\n<h2>\u5728404 Not Found\u65f6\u9690\u85cfnginx\u7684\u7248\u672c<\/h2>\n<pre class=\"post-pre\"><code><span class=\"gd\">-   # server_tokens off;\r\n<\/span><span class=\"gi\">+   server_tokens off;\r\n<\/span><\/code><\/pre>\n<h2>\u66f4\u6539\u4e0a\u4f20\u4e0a\u9650<\/h2>\n<p>\u521d\u59cb\u503c\u4e3a1MB zh\u00ed 1MB)<\/p>\n<ul class=\"post-ul\">nginx\u3067&#8221;client intended to send too large body&#8221;\u304c\u767a\u751f\u3057\u305f\u6642\u306e\u5bfe\u7b56\u65b9\u6cd5 &#8211; Qiita<\/ul>\n<pre class=\"post-pre\"><code> http {\r\n     server {\r\n<span class=\"gi\">+        client_max_body_size 1000m;\r\n<\/span>     }\r\n }\r\n<\/code><\/pre>\n<pre class=\"post-pre\"><code><span class=\"gi\">+ memory_limit = 1000M\r\n+ post_max_size = 0\r\n+ upload_max_filesize = 0\r\n<\/span><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>ubuntu 16.04 \u306b\u3066\u5b9f\u65bd \u5b89\u88c5 apt-get install -y \\ nginx php-fpm [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-30190","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528nginx-php-fpm\u6765\u8fd0\u884cphp\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528nginx-php-fpm\u6765\u8fd0\u884cphp\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-10T05:39:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T10:00:24+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d060837434c4406bdaadd\/18-0.png\" \/>\n<meta name=\"author\" content=\"\u79d1, \u9896\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u9896\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/\",\"name\":\"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-08-10T05:39:33+00:00\",\"dateModified\":\"2025-08-12T10:00:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\"},\"description\":\"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\",\"name\":\"\u79d1, \u9896\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u9896\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp - Blog - Silicon Cloud","description":"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528nginx-php-fpm\u6765\u8fd0\u884cphp\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp","og_description":"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528nginx-php-fpm\u6765\u8fd0\u884cphp\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-08-10T05:39:33+00:00","article_modified_time":"2025-08-12T10:00:24+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d060837434c4406bdaadd\/18-0.png"}],"author":"\u79d1, \u9896","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u9896","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/","name":"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-08-10T05:39:33+00:00","dateModified":"2025-08-12T10:00:24+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e"},"description":"\u5173\u4e8e\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528nginx + php-fpm\u6765\u8fd0\u884cphp"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e","name":"\u79d1, \u9896","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","caption":"\u79d1, \u9896"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8nginx-php-fpm%e6%9d%a5%e8%bf%90%e8%a1%8cphp\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=30190"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30190\/revisions"}],"predecessor-version":[{"id":74922,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30190\/revisions\/74922"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=30190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=30190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=30190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}