简体   繁体   English

在Apache 2.4中使用密码锁定Wordpress / wp-admin /

[英]Lock Wordpress /wp-admin/ using password with Apache 2.4

I want to lock down /wp-admin/ area with a login and password. 我想用登录名和密码锁定/ wp-admin /区域。 On Apache 2.3, I used to config my /var/www/html/wp-admin/.htaccess like this: 在Apache 2.3上,我曾经这样配置/var/www/html/wp-admin/.htaccess

AuthType Basic
AuthName "Restricted files"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
<Files admin-ajax.php>
    Order allow,deny
    Allow from all
    Satisfy any
</Files>

How the same configuration is done on Apache 2.4? 在Apache 2.4上如何进行相同的配置?

Apache 2.4 is exactly the same as 2.2 for password protecting a directory. Apache 2.4与2.2完全相同,用于保护目录的密码。 I use this on a number of sites running on 2.4: 我在2.4上运行的许多站点上使用了此方法:

AuthType Basic
AuthName "Restricted Access"
AuthUserFile /this/is/your/dir/.htpasswd
Require valid-user

Then you obviously have your .htpasswd file which looks like: 然后,您显然拥有了.htpasswd文件,该文件如下所示:

admin:Umvdgh40rXES3ChsKg444

For access to your file in Apache 2.4: 要在Apache 2.4中访问文件:

<Files admin-ajax.php>
    Require all granted
</Files>

You can view the Apache Documentation for the upgrade by following this link http://httpd.apache.org/docs/2.4/upgrading.html 您可以通过以下链接http://httpd.apache.org/docs/2.4/upgrading.html查看Apache文档进行升级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM