{"id":814,"date":"2013-04-25T08:30:38","date_gmt":"2013-04-25T08:30:38","guid":{"rendered":"https:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=814"},"modified":"2019-06-20T10:26:12","modified_gmt":"2019-06-20T02:26:12","slug":"htaccess-apache-%e5%ad%98%e5%8f%96%e6%8e%a7%e5%88%b6","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=814","title":{"rendered":"htaccess ( apache \u5b58\u53d6\u63a7\u5236 )"},"content":{"rendered":"<ol>\n<li>\u4fee\u6539 \/etc\/httpd\/conf\/httpd.conf<\/li>\n<\/ol>\n<pre lang=\"apache\">&lt;Directory \"\/var\/www\/html\"&gt;\n\n#\n# Possible values for the Options directive are \"None\", \"All\",\n# or any combination of:\n#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews\n#\n# Note that \"MultiViews\" must be named *explicitly* --- \"Options All\"\n# doesn't give it to you.\n#\n# The Options directive is both complicated and important.  Please see\n# http:\/\/httpd.apache.org\/docs\/2.2\/mod\/core.html#options\n# for more information.\n#\n    Options Indexes FollowSymLinks\n\n#\n# AllowOverride controls what directives may be placed in .htaccess files.\n# It can be \"All\", \"None\", or any combination of the keywords:\n#   Options FileInfo AuthConfig Limit\n#\n#    AllowOverride None\n    AllowOverride All \/\/====\u4fee\u6539\u70baAll\n\n#\n# Controls who can get stuff from this server.\n#\n    Order allow,deny\n    Allow from all<\/pre>\n<p>\u5230\u5b58\u53d6\u63a7\u5236\u7684\u76ee\u9304\u4e0b\u65b0\u589e\u6a94\u6848 .htaccess<\/p>\n<pre lang=\"apache\">\nvim .\/htaccess\n\n<files \u63a7\u7ba1\u7684\u6a94\u6848>\n  order deny,allow\n  deny from all\n<\/files>\n\nAuthName        \"Pop UP \u8996\u7a97\u986f\u793a\u7684\u6587\u5b57\"\nAuthUserFile    \u5bc6\u78bc\u6a94\u6848\u5b58\u653e\u5730\nAuthType        Basic\nRequire valid-user\nOrder           Deny,Allow\nDeny from       all\nAllow from      \u5141\u8a31\u76f4\u63a5\u5b58\u53d6\u7684\u7db2\u6bb5\uff0c\u4e0d\u9700\u8981\u8f38\u5165\u5bc6\u78bc\nSatisfy Any\n<\/pre>\n<p>\u8a2d\u5b9a\u6b0a\u9650 htpasswd<br \/>\n\u7b2c\u4e00\u6b21\u4f7f\u7528\u6642\u53c3\u6578\u70ba &#8220;-c&#8221;<\/p>\n<pre lang=\"bash\">\n[root@localhost ~]# htpasswd\nUsage:\n        htpasswd [-cmdpsD] passwordfile username\n        htpasswd -b[cmdpsD] passwordfile username password\n\n        htpasswd -n[mdps] username\n        htpasswd -nb[mdps] username password\n -c  Create a new file.\n -n  Do not update file; display results on stdout.\n -m  Force MD5 encryption of the password.\n -d  Force CRYPT encryption of the password (default).\n -p  Do not encrypt the password (plaintext).\n -s  Force SHA encryption of the password.\n -b  Use the password from the command line rather than prompting for it.\n -D  Delete the specified user.\n\n[root@localhost ~]# htpasswd -c \u5bc6\u78bc\u6a94\u6848\u5b58\u653e\u8def\u5f91 \u4f7f\u7528\u8005\u540d\u7a31\nNew password:\nRe-type new password:\nAdding password for user \u4f7f\u7528\u8005\u540d\u7a31\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u6539 \/etc\/httpd\/conf\/httpd.conf &lt;Directory &#8220;\/var\/www\/html&#8221;&gt; # # Possible values for the Options directive are &#8220;None&#8221;, &#8220;All&#8221;, # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that &#8220;MultiViews&#8221; must be named *explicitly* &#8212; &#8220;Options All&#8221; # &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=814\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"class_list":["post-814","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/814","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=814"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/814\/revisions"}],"predecessor-version":[{"id":2091,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/814\/revisions\/2091"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=814"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=814"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=814"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}