{"id":4403,"date":"2022-03-02T20:41:09","date_gmt":"2022-03-02T11:41:09","guid":{"rendered":"https:\/\/www.wsmeguro.jp\/wp\/?p=4403"},"modified":"2022-03-02T20:43:36","modified_gmt":"2022-03-02T11:43:36","slug":"raspberry-pi%e3%81%abnginx%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%97%e3%81%9f%e3%83%a1%e3%83%a2","status":"publish","type":"post","link":"https:\/\/www.wsmeguro.jp\/wp\/?p=4403","title":{"rendered":"Raspberry Pi\u306bnginx\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30e1\u30e2"},"content":{"rendered":"<p>Raspberry pi\u306bnginx\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30e1\u30e2\u3067\u3059\u3002<br \/>\n\u53c2\u8003\u306b\u3057\u305f<a href=\"https:\/\/www.ukeyslabo.com\/raspberry-pi\/nginx-php7-lets-encrypt\/\" target=\"_blank\" rel=\"noopener\">\u30b5\u30a4\u30c8<\/a>\u306f\u3053\u3061\u3089\u3067\u3059\u3002<\/p>\n<p>1.ngin\uff58\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code>sudo apt install nginx<\/code><br \/>\n2.php\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff08\u3059\u3067\u306b\u5165\u3063\u3066\u3044\u308b\u3051\u3069\u3001\u4e0b\u306e\uff14\u3064\u306f\u5165\u308c\u305f\u307b\u3046\u304c\u3044\u3044\u307f\u305f\u3044\uff09<br \/>\n<code>sudo apt install php7.4 php7.4-fpm php7.4-dev php7.4-mbstring<\/code><br \/>\n3.\u30e6\u30fc\u30b6\u300cnginx\u300d\u306e\u4f5c\u6210<br \/>\n<code>sudo useradd --shell \/sbin\/nologin nginx<\/code><br \/>\n4.nginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63<br \/>\n<code>sudo nano \/etc\/nginx\/sites-available\/default<\/code><br \/>\n\u2460root\u30d5\u30a9\u30eb\u30c0\u3092\u5909\u66f4<br \/>\n<code>\t#root \/var\/www\/html;<br \/>\nroot \/home\/pi\/html;<\/code><br \/>\n\u2461index.php\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3068\u3057\u3066\u767b\u9332<br \/>\n<code>\tindex index.html index.htm index.nginx-debian.html <b>index.php<\/b>;<\/code><br \/>\n\u2462php\u3068\u306e\u9023\u643a\uff08\u592a\u5b57\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3059\u3002php7.\uff14-fpm.sock\u3092\/var\/\u306b\u3042\u308b\u65b9\u306b\u3059\u308b\u3002\uff09<br \/>\n<code>\t<b>#<\/b>location ~ \\.php$ {<br \/>\n<b>#<\/b>\tinclude snippets\/fastcgi-php.conf;<br \/>\n#<br \/>\n#\t# With php-fpm (or other unix sockets):<br \/>\n<b>#<\/b>\tfastcgi_pass unix:<b>\/var<\/b>\/run\/php\/php7.4-fpm.sock;<br \/>\n#\t# With php-cgi (or other tcp sockets):<br \/>\n#\tfastcgi_pass 127.0.0.1:9000;<br \/>\n<b>#<\/b>}<\/code><br \/>\n5.php\u306e\u8a2d\u5b9a\u3092\u5909\u3048\u308b\uff08\u305d\u306e\uff11\uff09<br \/>\n<code>sudo nano \/etc\/php\/7.4\/fpm\/php-fpm.conf<\/code><br \/>\n\u2460php7.\uff14-fpm.sock\u3092\/var\/\u306b\u3042\u308b\u65b9\u306b\u3059\u308b\u3002<br \/>\n<code>pid = \/var\/run\/php\/php7.4-fpm.pid<\/code><br \/>\n\u2461daemonize = yes\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u5916\u3059\u2192\u30bb\u30df\u30b3\u30ed\u30f3\u3092\u524a\u9664<br \/>\n<code><b>;<\/b>daemonize = yes<\/code><br \/>\n6.php\u306e\u8a2d\u5b9a\u3092\u5909\u3048\u308b\uff08\u305d\u306e\uff12\uff09<br \/>\n<code>sudo nano \/etc\/php\/7.4\/fpm\/pool.d\/www.con<\/code><br \/>\n\u2460\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u3092\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u306b\u5909\u3048\u308b<br \/>\n<code>;user = www-data<br \/>\nuser = nginx<br \/>\n;group = www-data<br \/>\ngroup = nginx<\/code><br \/>\n\u2461\u540c\u3058php7.4-fpm.sock\u3092\u53c2\u7167\u3059\u308b<br \/>\n<code>listen = \/var\/run\/php\/php7.4-fpm.sock<\/code><br \/>\n\u2462Listen\u306e\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u3092\u5909\u3048\u308b<br \/>\n<code>;listen.owner = www-data<br \/>\nlisten.owner = nginx<br \/>\n;listen.group = www-data<br \/>\nlisten.group = nginx<\/code><br \/>\n\u2463Listen\u306e\u30e2\u30fc\u30c9\u3092\uff10\uff16\uff16\uff10\u304b\u3089\uff10\uff16\uff16\uff16\u306b\u5909\u3048\u308b<br \/>\n<code>listen.mode = 0666<\/code><br \/>\n6.\u8a2d\u5b9a\u304c\u554f\u984c\u306a\u3044\u304b\u78ba\u8a8d\u3059\u308b<br \/>\n<code>nginx -t<\/code><br \/>\n7.\u30b5\u30f3\u30d7\u30eb\u30da\u30fc\u30b8\u3092\u4f5c\u6210<br \/>\n<code>nano \/home\/pi\/script\/index.php<\/code><br \/>\n<code>&#12296;?php<br \/>\n\tphpinfo();<\/code><br \/>\n8.php\u3068nginx\u3092\u518d\u8d77\u52d5<br \/>\n<code>sudo systemctl restart php7.4-fpm<br \/>\nsudo systemctl restart nginx<\/code><br \/>\n9.\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3092\u958b\u3044\u3066php\u3000info\u304c\u8868\u793a\u3055\u308c\u308c\u3070OK\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Raspberry pi\u306bnginx\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30e1\u30e2\u3067\u3059\u3002 \u53c2\u8003\u306b\u3057\u305f\u30b5\u30a4\u30c8\u306f\u3053\u3061\u3089\u3067\u3059\u3002 1.ngin\uff58\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb sudo apt install nginx 2.php\u3082\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\uff08\u3059\u3067\u306b\u5165\u3063\u3066\u3044\u308b\u3051\u3069&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[481,492],"tags":[658,497],"class_list":["post-4403","post","type-post","status-publish","format-standard","hentry","category-raspberry-pitinker-board","category-492","tag-nginx","tag-php"],"_links":{"self":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4403"}],"version-history":[{"count":4,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4403\/revisions"}],"predecessor-version":[{"id":4407,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=\/wp\/v2\/posts\/4403\/revisions\/4407"}],"wp:attachment":[{"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsmeguro.jp\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}