{"id":578,"date":"2018-05-13T20:10:19","date_gmt":"2018-05-13T11:10:19","guid":{"rendered":"https:\/\/yuis-programming.com\/?p=578"},"modified":"2018-04-29T20:11:20","modified_gmt":"2018-04-29T11:11:20","slug":"apache%e3%81%a7-htaccess%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6basic%e8%aa%8d%e8%a8%bc%e3%83%91%e3%82%b9%e3%83%af%e3%83%bc%e3%83%89%e3%82%92%e8%a8%ad%e5%ae%9a%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/yuis-programming.com\/?p=578","title":{"rendered":"Apache\u3067.htaccess\u3092\u4f7f\u3063\u3066Basic\u8a8d\u8a3c(\u30d1\u30b9\u30ef\u30fc\u30c9)\u3092\u8a2d\u5b9a\u3059\u308b"},"content":{"rendered":"<p>.htaccess\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3002<br \/>\n<code>AuthUserfile<\/code>\u3092\u3001\u516c\u958b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u66f8\u304d\u63db\u3048\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n.htpasswd\u306f\u3042\u3068\u3067\u751f\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code># Basic\u8a8d\u8a3c\n\nAuthUserfile \/home\/yuis\/yuis.xsrv.jp\/public_html\/.htpasswd\nAuthGroupfile \/dev\/null\nAuthName \"Enter username and password.\"\nAuthType Basic\nrequire valid-user\n\n<\/code><\/pre>\n<h2>.htpasswd\u3092\u751f\u6210\u3059\u308b<\/h2>\n<p>.htpasswd\u3068\u3044\u3046\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u60c5\u5831\u304c\u8a18\u8f09\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3057\u307e\u3059\u3002<br \/>\n\u50d5\u306f\u3053\u3053\u3067\u5c0f\u4e00\u6642\u9593\u30cf\u30de\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001\u5358\u306b\u66f8\u3051\u3070\u3044\u3044\u3068\u3044\u3046\u308f\u3051\u3067\u306f\u306a\u304f\u3001<br \/>\n\u30b3\u30de\u30f3\u30c9\u3067\u751f\u6210\u3057\u3066\u4e0a\u3052\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u3041\u3064\u307e\u308a\u3001<\/p>\n<pre><code>cat &lt;&lt; EOT &gt;&gt; .htpasswd\nusername:password\n<\/code><\/pre>\n<p>\u307f\u305f\u3044\u306b\u624b\u52d5\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u66f8\u304f\u306e\u306f\u610f\u5473\u306a\u3044\u3093\u3067\u3059\u306d\u3002<\/p>\n<p>\u50d5\u306f\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u304b\u77e5\u3089\u306a\u3044\u306e\u3067\u76f4\u63a5\u4f5c\u6210\u3057\u3066\u3042\u3052\u308b\u3082\u306e\u3068\u3070\u304b\u308a\u601d\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u30b3\u30de\u30f3\u30c9\u3067\u751f\u6210\u3057\u3066\u4e0a\u3052\u308b\u5fc5\u8981\u304c\u3042\u308b\u3063\u3066\u3053\u3068\u3067\u3059\u3002<\/p>\n<p>\u3067\u306f\u3001.htpasswd\u306e\u4f5c\u308a\u65b9\u3002<\/p>\n<pre><code># cd \u3067\u516c\u958b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u79fb\u52d5\u3002\ncd  \/home\/yuis\/yuis.xsrv.jp\/public_html\/\n\n# \u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u751f\u6210\u3002\n# \u30d1\u30b9\u30ef\u30fc\u30c9\u304c\u898b\u3048\u3066\u3057\u307e\u3046\u306e\u3067\u6ce8\u610f\u3002\n# htpasswd -b -c .htpasswd [\u30e6\u30fc\u30b6\u30fc\u540d] [\u30d1\u30b9\u30ef\u30fc\u30c9]\nhtpasswd -b -c .htpasswd yuis password\n# or\n# \u4e00\u822c\u7684\u306a\u751f\u6210\u65b9\u6cd5\nhtpasswd -c .htpasswd yuis\n<\/code><\/pre>\n<p>\u3053\u308c\u3067\u3001<code>\/home\/yuis\/yuis.xsrv.jp\/public_html\/.htpasswd<\/code>\u304c\u751f\u6210\u3067\u304d\u305f\u308f\u3051\u3067\u3001\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u5148\u7a0b\u306e<code>AuthUserfile<\/code>\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u7f6e\u3057\u305f\u3044\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e.htaccess\u3067\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001<br \/>\n\u6e96\u5099\u306f\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n<p>\u3067\u306f\u3001\u5b9f\u969b\u306b\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u691c\u8a3c\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<p><img src=\"https:\/\/i.imgur.com\/xJ5OWFG.png\" alt=\"https:\/\/i.imgur.com\/xJ5OWFG.png\" \/><\/p>\n<p>\u3053\u3093\u306a\u611f\u3058\u3067\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3068\u30e6\u30fc\u30b6\u30fc\u540d\u3092\u8981\u6c42\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u5148\u7a0b\u306e\u30e6\u30fc\u30b6\u30fc\u540d\u3068\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u2026<\/p>\n<p>\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<p>500 internal server error\u304c\u51fa\u305f\u5834\u5408\u306f\u3001\u4f55\u304b\u304c\u9593\u9055\u3063\u3066\u3044\u308b\u3068\u3044\u3046\u3053\u3068\u3089\u3057\u3044\u3067\u3059\u306e\u3067\u3001\u8272\u3005\u898b\u76f4\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<h2>\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/qiita.com\/yuwaita\/items\/e406c645ae8d0cc3c3fa\">https:\/\/qiita.com\/yuwaita\/items\/e406c645ae8d0cc3c3fa<\/a><br \/>\n<a href=\"http:\/\/www.umin.ac.jp\/hp-coordinator\/man\/htaccess.html\">http:\/\/www.umin.ac.jp\/hp-coordinator\/man\/htaccess.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>.htaccess\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3002 AuthUserfile\u3092\u3001\u516c\u958b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u66f8 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[1],"tags":[],"acf":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8Rxwo-9k","_links":{"self":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/578"}],"collection":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=578"}],"version-history":[{"count":1,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/578\/revisions"}],"predecessor-version":[{"id":579,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=\/wp\/v2\/posts\/578\/revisions\/579"}],"wp:attachment":[{"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=578"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=578"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yuis-programming.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=578"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}