{"id":5816,"date":"2021-09-30T13:32:23","date_gmt":"2021-09-30T04:32:23","guid":{"rendered":"https:\/\/www.sria.co.jp\/blog\/?p=5816"},"modified":"2021-09-30T09:32:34","modified_gmt":"2021-09-30T00:32:34","slug":"5816","status":"publish","type":"post","link":"https:\/\/www.sria.co.jp\/blog\/2021\/09\/5816\/","title":{"rendered":"\u3010Azure\u3011AppSerivce on Linux\u4e0a\u306ePHP\u30a2\u30d7\u30ea\u3067500\u30a8\u30e9\u30fc\u304c404\u30a8\u30e9\u30fc\u306b\u306a\u308b\u73fe\u8c61\u3068\u89e3\u6c7a\u7b56"},"content":{"rendered":"<p>Azure\u306eAppService on Linux\u4e0a\u3067PHP\u30a2\u30d7\u30ea\u306e\u958b\u767a\u3092\u884c\u306a\u3063\u3066\u3044\u305f\u969b\u306b\u3001PHP\u30a2\u30d7\u30ea\u5074\u3067500\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u3068\u3001404\u30a8\u30e9\u30fc\u306b\u306a\u308b\u73fe\u8c61\u306b\u906d\u9047\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u89e3\u6c7a\u7b56\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<ol>\n<li>\u73fe\u8c61\u306b\u3064\u3044\u3066<\/li>\n<li>\u539f\u56e0<\/li>\n<li>\u89e3\u6c7a\u7b56<\/li>\n<li>\u307e\u3068\u3081<\/li>\n<\/ol>\n<h2>1.\u00a0 \u73fe\u8c61\u306b\u3064\u3044\u3066<\/h2>\n<p>AppService on Linux\u4e0a\u306bPHP\u30a2\u30d7\u30ea\u3092\u30c7\u30d7\u30ed\u30a4\u3057\u305f\u969b\u306b\u3001500\u7cfb\u306e\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u3068\u5168\u3066404\u30a8\u30e9\u30fc\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3068\u3044\u3046\u73fe\u8c61\u304c\u8d77\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>500\u7cfb\u306e\u30a8\u30e9\u30fc\u306f\u30ed\u30fc\u30ab\u30eb\u3067\u306f\u3001500\u7cfb\u306e\u30a8\u30e9\u30fc\u3068\u3057\u3066\u51e6\u7406\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u304c\u3001AppService on Linux\u4e0a\u3060\u3051\u3067\u3053\u306e\u73fe\u8c61\u306f\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<h2>2. \u539f\u56e0<\/h2>\n<p>\u30ed\u30b0\u3092\u78ba\u8a8d\u3057\u305f\u3068\u3053\u308d\u3001PHP\u30a2\u30d7\u30ea\u4e0a\u3067\u306f\u3001500\u7cfb\u306e\u30a8\u30e9\u30fc\u3068\u3057\u3066\u51e6\u7406\u3055\u308c\u3066\u3044\u305f\u306e\u3067\u3001AppService on Linux\u306eWeb\u30b5\u30fc\u30d0\u3067\u3042\u308bNginx\u306e\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><strong><code>\/etc\/nginx\/nginx.conf<\/code><\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>\/\/ ... \u7565\n\n\/etc\/nginx\/sites-enabled\/*;\n\n\/\/ ... \u7565\n<\/code><\/pre>\n<\/div>\n<p>\/etc\/nginx\/sites-enabled\/*\u306e\u8a2d\u5b9a\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u308b\u3088\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u78ba\u8a8d\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<p><code><strong>\/etc\/nginx\/sites-enabled\/default<\/strong><\/code><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>server {\n    #proxy_cache cache;\n    #proxy_cache_valid 200 1s;\n    listen 8080;\n    listen [::]:8080;\n    root \/home\/site\/wwwroot;\n    index index.php index.html index.htm;\n    server_name example.com www.example.com;\n    location \/ {\n        index index.php index.html index.htm hostingstart.html;\n    }\n    # redirect server error pages to the static page \/50x.html\n    #\n    error_page 500 502 503 504 \/50x.html;\n    location = \/50x.html {\n        root \/html\/;\n    }\n\n\/\/ ... \u7565\n}<\/code><\/pre>\n<\/div>\n<p>\u8a2d\u5b9a\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3001500\u7cfb\u306e\u30a8\u30e9\u30fc\u306f\/html\/50x.html\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u3057\u304b\u3057\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306e\/html\/50x.html\u306f\u5b58\u5728\u305b\u305a\u3001404\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3044\u308b\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u4fee\u6b63\u3059\u308c\u3070\u89e3\u6c7a\u3057\u305d\u3046\u3067\u3059\u3002<\/p>\n<h2>3. \u89e3\u6c7a\u7b56<\/h2>\n<p>\u89e3\u6c7a\u7b56\u3068\u3057\u3066\u306f\u3001Nginx\u306e\u8a2d\u5b9a\u3067<\/p>\n<ul>\n<li>500\u7cfb\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u969b\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306b\u8a72\u5f53\u306eHTML\u3092\u914d\u7f6e\u3059\u308b\u304b<\/li>\n<li>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u3092\u5909\u66f4\u3059\u308b\u304b<\/li>\n<\/ul>\n<p>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001\u3053\u3061\u3089\u3067\u4f5c\u6210\u3057\u305f\u6c38\u7d9a\u5316\u3055\u308c\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306eHTML\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u305b\u305f\u3044\u306e\u3067\u3001\u300c\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u3092\u5909\u66f4\u3059\u308b\u300d\u3067\u89e3\u6c7a\u3057\u307e\u3059\u3002<\/p>\n<p>\u305f\u3060\u3001AppService\u306e\u7279\u6027\u4e0a\u3001\u30c7\u30d7\u30ed\u30a4\u306a\u3069\u3067\u518d\u8d77\u52d5\u3059\u308b\u3068\u3001Nginx\u306a\u3069\u306e\u8a2d\u5b9a\u304c\u521d\u671f\u5024\u306b\u623b\u3063\u3066\u3057\u307e\u3044\u3001\u305d\u306e\u90fd\u5ea6\u8a2d\u5b9a\u3057\u306a\u304a\u3055\u306a\u3044\u3068\u3044\u3051\u306a\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001AppService\u306e\u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7\u30b3\u30de\u30f3\u30c9\u3092\u8a2d\u5b9a\u3067\u304d\u308b\u6a5f\u80fd\u3067Nginx\u306e\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u3088\u3046\u306b\u3057\u3001\u5bfe\u5fdc\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7.png\"><img loading=\"lazy\" src=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7-300x111.png\" alt=\"\" width=\"300\" height=\"111\" class=\"alignnone size-medium wp-image-5823\" srcset=\"https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7-300x111.png 300w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7-1024x378.png 1024w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7-768x284.png 768w, https:\/\/www.sria.co.jp\/blog\/wp-content\/uploads\/2021\/09\/d8a3f8118920d592eea2f31400b62db7.png 1048w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h3>3-1. PHP\u30a2\u30d7\u30ea\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306bNginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306850x.html\u3092\u7528\u610f\u3059\u308b<\/h3>\n<p>\u307e\u305a\u306f500\u7cfb\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306e50x.html\u3092\u7528\u610f\u3057\u3001PHP\u30a2\u30d7\u30ea\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u914d\u4e0b\u306b\u914d\u7f6e\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u305d\u3057\u3066\u3001AppService\u4e0a\u306e\/etc\/nginx\/sites-enabled\/default\u3092\u30b3\u30d4\u30fc\u3057\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u914d\u4e0b\u306bdefault\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u8cbc\u308a\u4ed8\u3051\u3001\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u304cPHP\u30a2\u30d7\u30ea\u914d\u4e0b\u306b\u3042\u308bHTML\u306b\u306a\u308b\u3088\u3046\u306b\u4fee\u6b63\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><strong>default<\/strong><\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>server {\n\/\/ ... \u7565\n    error_page 500 502 503 504 \/50x.html;\n    location = \/50x.html {\n        root \/home\/site\/wwwroot\/;\n    }\n\n\/\/ ... \u7565\n}\n<\/code><\/pre>\n<\/div>\n<h3>3-2. \u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7\u30b3\u30de\u30f3\u30c9\u3067\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u8a2d\u5b9a\u3059\u308b<\/h3>\n<p>Azure\u306eAppService\u306e\u30dd\u30fc\u30bf\u30eb\u306e\u30b9\u30bf\u30fc\u30c8\u30a2\u30c3\u30d7\u30b3\u30de\u30f3\u30c9\u306b\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u914d\u4e0b\u306b\u3042\u308bNginx\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u300cdefault\u300d\u3092\u53c2\u7167\u3059\u308b\u30b7\u30f3\u30dc\u30ea\u30c3\u30af\u30ea\u30f3\u30af\u3092\u4f5c\u6210\u3059\u308b\u30b3\u30de\u30f3\u30c9\u3092\u5165\u529b\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>ln -nfs \/home\/site\/wwwroot\/default \/etc\/nginx\/sites-enabled\/default; nginx -s reload<\/code><\/pre>\n<\/div>\n<p>\u3053\u308c\u3067\u518d\u8d77\u52d5\u3057\u3066\u3082\u3001500\u7cfb\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u305f\u969b\u306b404\u30a8\u30e9\u30fc\u306b\u306a\u3089\u305a\u306b\u6307\u5b9a\u3057\u305fHTML\u306b\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<h2>4. \u307e\u3068\u3081<\/h2>\n<p>\u306a\u305c\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3067500\u7cfb\u306e\u30a8\u30e9\u30fc\u306e\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u5148\u306bHTML\u304c\u306a\u3044\u306e\u304b\u306f\u308f\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u73fe\u72b6\uff082021\/09\/21\u6642\u70b9\uff09\u3053\u306e\u65b9\u6cd5\u3067\u5bfe\u5fdc\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>\u5c11\u3057\u3067\u3082\u53c2\u8003\u306b\u306a\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Azure\u306eAppService on Linux\u4e0a\u3067PHP\u30a2\u30d7\u30ea\u306e\u958b\u767a\u3092\u884c\u306a\u3063\u3066\u3044\u305f\u969b\u306b\u3001PHP\u30a2\u30d7\u30ea\u5074\u3067500\u30a8\u30e9\u30fc\u304c\u8d77\u3053\u308b\u3068\u3001404\u30a8\u30e9\u30fc\u306b\u306a\u308b\u73fe\u8c61\u306b\u906d\u9047\u3057\u305f\u306e\u3067\u3001\u305d\u306e\u89e3\u6c7a\u7b56\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002 \u73fe\u8c61\u306b\u3064\u3044\u3066 \u539f\u56e0 \u89e3\u6c7a&#8230;<\/p>\n","protected":false},"author":5,"featured_media":5159,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[179,8],"tags":[159,50],"_links":{"self":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5816"}],"collection":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/comments?post=5816"}],"version-history":[{"count":18,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5816\/revisions"}],"predecessor-version":[{"id":6041,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/posts\/5816\/revisions\/6041"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media\/5159"}],"wp:attachment":[{"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/media?parent=5816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/categories?post=5816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sria.co.jp\/blog\/wp-json\/wp\/v2\/tags?post=5816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}