{"id":13102,"date":"2026-02-24T21:20:30","date_gmt":"2026-02-24T12:20:30","guid":{"rendered":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/?p=13102"},"modified":"2026-02-24T21:20:30","modified_gmt":"2026-02-24T12:20:30","slug":"nginx-php-integration","status":"publish","type":"post","link":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/2026\/02\/24\/nginx-php-integration\/","title":{"rendered":"\u3010Xserver VPS\u3011PHP 8.4\u74b0\u5883\u306e\u69cb\u7bc9\u3068Nginx\u3068\u306e\u9023\u643a\u624b\u9806"},"content":{"rendered":"<p>\u30b5\u30fc\u30d0\u30fc\u57fa\u76e4\u3068\u3057\u3066\u306eNginx\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u3057\u3066\u306eMySQL\u3092\u5c0e\u5165\u3057\u305f\u524d\u56de\u306b\u7d9a\u304d\u3001\u4eca\u56de\u306f\u52d5\u7684\u30b3\u30f3\u30c6\u30f3\u30c4\u306e\u51e6\u7406\u3092\u62c5\u3046PHP\u74b0\u5883\u306e\u69cb\u7bc9\u624b\u9806\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002Ubuntu 25.04\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u3092\u7528\u3044\u6700\u65b0\u306ePHP 8.4\u3092\u5c0e\u5165\u3057\u3002Nginx\u3068\u306e\u9023\u643a\u306b\u304a\u3044\u3066\u306fTCP\u30bd\u30b1\u30c3\u30c8\u3067\u306f\u306a\u304f\u3088\u308a\u30aa\u30fc\u30d0\u30fc\u30d8\u30c3\u30c9\u306e\u5c11\u306a\u3044Unix\u30c9\u30e1\u30a4\u30f3\u30bd\u30b1\u30c3\u30c8\u3092\u7528\u3044\u305fPHP-FPM\u306e\u8a2d\u5b9a\u624b\u6cd5\u3092\u63a1\u7528\u3057\u307e\u3057\u305f\u3002<\/p>\n<h2>1. PHP 8.4 \u304a\u3088\u3073\u95a2\u9023\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u958b\u767a\u306b\u4e0d\u53ef\u6b20\u306aPHP\u672c\u4f53\u3001\u304a\u3088\u3073\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u9023\u643a\u3084\u6587\u5b57\u5217\u51e6\u7406\u306e\u305f\u3081\u306e\u62e1\u5f35\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4e00\u62ec\u3067\u5c0e\u5165\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \u30d1\u30c3\u30b1\u30fc\u30b8\u30ea\u30b9\u30c8\u306e\u66f4\u65b0\r\nsudo apt update\r\n\r\n# PHP 8.4\u672c\u4f53\u3001FPM\u3001\u304a\u3088\u3073\u4e3b\u8981\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\nsudo apt install -y php8.4-fpm php8.4-mysql php8.4-common php8.4-cli php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-zip\r\n\r\n# \u4f9d\u5b58\u95a2\u4fc2\u306b\u3042\u308b\u5171\u901a\u30c4\u30fc\u30eb\u306e\u5c0e\u5165\r\nsudo apt install -y unzip zip git\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>2. PHP-FPM \u30b5\u30fc\u30d3\u30b9\u306e\u7a3c\u50cd\u78ba\u8a8d<\/h2>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u305f\u30b5\u30fc\u30d3\u30b9\u304c\u6b63\u5e38\u306b\u30c7\u30fc\u30e2\u30f3\u3068\u3057\u3066\u8d77\u52d5\u3057\u3066\u3044\u308b\u304b\u3001\u307e\u305fNginx\u3068\u306e\u63a5\u70b9\u3068\u306a\u308b\u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u304c\u751f\u6210\u3055\u308c\u3066\u3044\u308b\u304b\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \u30b5\u30fc\u30d3\u30b9\u306e\u7a3c\u50cd\u30b9\u30c6\u30fc\u30bf\u30b9\u78ba\u8a8d\uff08\u300cActive: active (running)\u300d\u3092\u78ba\u8a8d\uff09\r\nsystemctl status php8.4-fpm\r\n\r\n# \u30bd\u30b1\u30c3\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u5b58\u5728\u78ba\u8a8d\r\nls -l \/run\/php\/php8.4-fpm.sock\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>3. Nginx \u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306e\u6700\u9069\u5316<\/h2>\n<p>Nginx\u304cPHP\u30d5\u30a1\u30a4\u30eb\u3092\u51e6\u7406\u3067\u304d\u308b\u3088\u3046\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3057\u307e\u3059\u3002\u512a\u5148\u9806\u4f4d\u306e\u8a2d\u5b9a\u3068\u3001PHP-FPM\u3078\u306e\u8ee2\u9001\u8a2d\u5b9a\uff08FastCGI\uff09\u3092\u884c\u3044\u307e\u3059\u3002<br \/>\n\u3010\u8a2d\u5b9a\u5909\u66f4\u306e\u30dd\u30a4\u30f3\u30c8\u3011<\/p>\n<ul>\n<li>index \u884c\u306e\u5148\u982d\u306b index.php \u3092\u8ffd\u52a0\u3057\u3001\u512a\u5148\u5ea6\u3092\u4e0a\u3052\u308b\u3002<\/li>\n<li>location ~ \\.php$ \u30d6\u30ed\u30c3\u30af\u3092\u6709\u52b9\u5316\u3057\u3001fastcgi_pass \u306b\u5148\u307b\u3069\u78ba\u8a8d\u3057\u305f .sock \u30d1\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3002<\/li>\n<\/ul>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6\r\nsudo nano \/etc\/nginx\/sites-available\/default\r\n\r\n# --- \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u629c\u7c8b ---\r\nindex index.php index.html index.htm;\r\n\r\nlocation ~ \\.php$ {\r\n    include snippets\/fastcgi-php.conf;\r\n    fastcgi_pass unix:\/run\/php\/php8.4-fpm.sock;\r\n}\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>4. \u8a2d\u5b9a\u306e\u53cd\u6620\u3068\u69cb\u6587\u30c1\u30a7\u30c3\u30af<\/h2>\n<p>\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u308b\u524d\u306b\u3001\u69cb\u6587\u30a8\u30e9\u30fc\u304c\u306a\u3044\u304b\u3092\u53b3\u5bc6\u306b\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# Nginx\u8a2d\u5b9a\u306e\u69cb\u6587\u30c1\u30a7\u30c3\u30af\r\nsudo nginx -t\r\n\r\n# \u8a2d\u5b9a\u306e\u518d\u8aad\u307f\u8fbc\u307f\r\nsudo systemctl restart nginx\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<h2>5. \u5b9f\u884c\u74b0\u5883\u306e\u6700\u7d42\u691c\u8a3c<\/h2>\n<p>\u30b5\u30fc\u30d0\u30fc\u4e0a\u3067\u5b9f\u969b\u306bPHP\u304c\u89e3\u91c8\u3055\u308c\u3066\u3044\u308b\u304b\u3001phpinfo() \u3092\u7528\u3044\u3066\u691c\u8a3c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \u30c6\u30b9\u30c8\u7528PHP\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\r\necho &quot;&lt;?php phpinfo(); ?&gt;&quot; | sudo tee \/var\/www\/html\/test.php\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u3067 https:\/\/\u30c9\u30e1\u30a4\u30f3\u540d\/test.php \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3001PHP\u306e\u69cb\u6210\u60c5\u5831\uff08\u7d2b\u8272\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\uff09\u304c\u8868\u793a\u3055\u308c\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2026\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2026-02-24-210237.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-13105\" src=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2026\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2026-02-24-210237-700x403.png\" alt=\"\" width=\"700\" height=\"403\" srcset=\"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2026\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2026-02-24-210237-700x403.png 700w, http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2026\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2026-02-24-210237-900x518.png 900w, http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-content\/uploads\/2026\/02\/\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8-2026-02-24-210237.png 1459w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u691c\u8a3c\u304c\u7d42\u308f\u3063\u305f\u3089\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u305f\u3081\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3067\u30c6\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u524a\u9664\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nsudo rm \/var\/www\/html\/test.php\r\n \r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30b5\u30fc\u30d0\u30fc\u57fa\u76e4\u3068\u3057\u3066\u306eNginx\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3068\u3057\u3066\u306eMySQL\u3092\u5c0e\u5165\u3057\u305f\u524d\u56de\u306b\u7d9a &#8230; <\/p>\n","protected":false},"author":1,"featured_media":13106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47,63],"tags":[],"class_list":["post-13102","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","category-xserver-vps"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/13102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/comments?post=13102"}],"version-history":[{"count":3,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/13102\/revisions"}],"predecessor-version":[{"id":13107,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/posts\/13102\/revisions\/13107"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/media\/13106"}],"wp:attachment":[{"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/media?parent=13102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/categories?post=13102"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/pineplanter.moo.jp\/non-it-salaryman\/wp-json\/wp\/v2\/tags?post=13102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}