{"id":529,"date":"2019-02-23T19:54:59","date_gmt":"2019-02-23T10:54:59","guid":{"rendered":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=529"},"modified":"2019-02-24T01:20:26","modified_gmt":"2019-02-23T16:20:26","slug":"vps%e3%81%ab-centos7-nginx-php-fpm-%e3%81%a7php%e7%92%b0%e5%a2%83%e3%82%92%e8%a8%ad%e5%ae%9a%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/windabaft.co.jp\/blog_ceo\/?p=529","title":{"rendered":"VPS\u306b CentOS7 + Nginx + php-fpm \u3067PHP\u74b0\u5883\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"\n<p>nginx\u3067Wordpress\u306e\u3088\u3046\u306aPHP\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u52d5\u4f5c\u3055\u305b\u308b\u306b\u306f<br \/>\u300cphp-fpm\u300d<br \/>\u3068\u3044\u3046\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u307e\u3059\u3002<br \/><br \/>VPS\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u72b6\u614b\u3067PHP\u3082\u307e\u3060\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u72b6\u614b\u3068\u60f3\u5b9a\u3057\u3066\u8aac\u660e\u3057\u3066\u3044\u307e\u3059\u3002<br \/><br \/>VPS\u306b\u306fWebArena VPS CentOS 7.4\u3092\u4f7f\u7528\u3002<br \/><br \/>php-fpm\u5165\u308c\u308b\u524d\u306bnginx\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046<br \/><a rel=\"noreferrer noopener\" aria-label=\"WebArena VPS CentOS 7.4 \u3078\u306e Nginx mainline\u7248 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb (\u65b0\u3057\u3044\u30bf\u30d6\u3067\u958b\u304f)\" href=\"https:\/\/windabaft.co.jp\/blog_ceo\/?p=522\" target=\"_blank\">WebArena VPS CentOS 7.4 \u3078\u306e Nginx mainline\u7248 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><br \/><br \/>nginx\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u304c\u5b8c\u4e86\u3057\u305f\u3089\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306bphp\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u30fbremi\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n# sudo yum install http:\/\/rpms.famillecollet.com\/enterprise\/remi-release-7.rpm\n\n\u30fbPHP\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u60c5\u5831\u3092\u78ba\u8a8d\n# yum info php --enablerepo=remi-php73\n\u5229\u7528\u53ef\u80fd\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\n\u540d\u524d                : php\n\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u30fc    : x86_64\n\u30d0\u30fc\u30b8\u30e7\u30f3          : 7.3.2\n\u30ea\u30ea\u30fc\u30b9            : 1.el7.remi\n\u5bb9\u91cf                : 3.2 M\n\u30ea\u30dd\u30b8\u30c8\u30ea\u30fc        : remi-php73\n\n\u30fbPHP 7.3 \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\n--enablerepo \u30aa\u30d7\u30b7\u30e7\u30f3\u3067 remi \u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u6307\u5b9a\u3001\n\u305d\u306e\u4ed6php\u306e\u62e1\u5f35\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u4e00\u7dd2\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002\n\u9014\u4e2d\u3001\u516c\u958b\u9375\u304c\u5165\u3063\u3066\u306a\u3044\u3088\uff01\u3068\u3044\u308f\u308c\u307e\u3059\u304c\u63a2\u3057\u3066\u304f\u308c\u308b\u306e\u3067\u805e\u304b\u308c\u305f\u3089y\u3067\u30ea\u30bf\u30fc\u30f3\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n# yum install --enablerepo=remi,remi-php73 php php-devel php-mbstring php-mysqlnd php-pdo php-gd\n\n\u30fb\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\n# php --version\nPHP 7.3.2 (cli) (built: Feb  5 2019 13:10:03) ( NTS )\nCopyright (c) 1997-2018 The PHP Group\nZend Engine v3.3.2, Copyright (c) 1998-2018 Zend Technologies<\/code><\/pre>\n\n\n\n<p>\u3053\u308c\u3067\u30012019\u5e74\uff12\u670823\u65e5\u6642\u70b9\u3067\u306e\u6700\u65b0\u306ePHP\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f\u3002<br \/><br \/>PHP-FPM\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo yum --enablerepo=remi-php73 install php-fpm<\/code><\/pre>\n\n\n\n<p>Apache\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u7279\u306b\u5909\u66f4\u306e\u5fc5\u8981\u306f\u306a\u3044\u306e\u3067\u3059\u304c\u3001<br \/>Nginx\u3092\u4f7f\u7528\u3059\u308b\u5834\u5408\u306f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u304c\u5fc5\u8981\u306b\u306a\u308a\u307e\u3059\u3002<br \/><code>\/etc\/php-fpm.d\/www.conf<\/code>\u5185\u306e<code>user<\/code>\u3068<code>group<\/code>\u3092<code>nginx<\/code>\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nano \/etc\/php-fpm.d\/www.conf\nuser = nginx\ngroup = nginx\n\n\u4fdd\u5b58\u3057\u305f\u3089\u3001PHP-FPM\u3092\u518d\u8d77\u52d5\u3057\u307e\u3059\n$ sudo systemctl restart php-fpm<\/code><\/pre>\n\n\n\n<p>Nginx\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3057\u3066PHP\u3092\u5b9f\u884c\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<br \/>\/etc\/nginx\/conf.d\/default.conf \u3092\u7de8\u96c6\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u30fb\u4eca\u5f8c\u306e\u305f\u3081\u306b\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3068\u3063\u3066\u304a\u304d\u307e\u3057\u3087\u3046\n$ sudo cp \/etc\/nginx\/conf.d\/default.conf \/etc\/nginx\/conf.d\/defaul-backup.conf\n\n\u30fb\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u7de8\u96c6\u3000index.php\u3092\u8ffd\u52a0\n$ sudo nano \/etc\/nginx\/conf.d\/default.conf\n\nlocation \/ {\n\n      root   \/usr\/share\/nginx\/html;\n\n      index index.php index.html index.htm;\n\n}\n\n\u30fbphp-fpm\u306e\u8a2d\u5b9a\u3092\u6709\u52b9\u5316\ndefault.conf\u3092\u3055\u3089\u306b\u4e0b\u306b\u30b9\u30af\u30ed\u30fc\u30eb\u3057\u3066\u3044\u304f\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306aphp-fpm\u3092\u52d5\u4f5c\u3055\u305b\u308b\u90e8\u5206\u304c\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u300c#\u300d\u3092\u524a\u9664\u3057\u307e\u3059\u3002\n\n   location ~ \\.php$ {\n\n            root           \/usr\/share\/nginx\/html;\n\n            fastcgi_pass   127.0.0.1:9000;\n\n            fastcgi_index  index.php;\n\n            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n\n            include        fastcgi_params;\n\n    }<\/code><\/pre>\n\n\n\n<p>nginx\u3068php-fpm\u306e\u8d77\u52d5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ systemctl start php-fpm\n$ systemctl start nginx\n\n\u30fb\u8d77\u52d5\u6642\u306bNginx\u3068php\u304c\u7acb\u3061\u4e0a\u3052\u308b\u3088\u3046\u306b\u3059\u308b\nsudo chkconfig php-fpm on\nsudo chkconfig nginx on\n\n\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u4e0b\u8a18\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066nginx\u306e\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u308c\u3070\u6210\u529f\nhttp:\/\/IP\u30a2\u30c9\u30ec\u30b9\/<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>nginx\u3067Wordpress\u306e\u3088\u3046\u306aPHP\u306eWeb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u52d5\u4f5c\u3055\u305b\u308b\u306b\u306f\u300cphp-fpm\u300d\u3068\u3044\u3046\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u7d44\u307f\u5408\u308f\u305b\u307e\u3059\u3002 VPS\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u72b6\u614b\u3067PHP\u3082\u307e\u3060\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3044\u72b6\u614b\u3068\u60f3\u5b9a\u3057\u3066 &hellip; <a href=\"https:\/\/windabaft.co.jp\/blog_ceo\/?p=529\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">VPS\u306b CentOS7 + Nginx + php-fpm \u3067PHP\u74b0\u5883\u3092\u8a2d\u5b9a\u3059\u308b\u65b9\u6cd5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":535,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[15],"tags":[],"class_list":["post-529","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/529","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=529"}],"version-history":[{"count":7,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/529\/revisions"}],"predecessor-version":[{"id":537,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/posts\/529\/revisions\/537"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=\/wp\/v2\/media\/535"}],"wp:attachment":[{"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=529"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=529"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/windabaft.co.jp\/blog_ceo\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=529"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}