how to config httpd .passwd protect wp-login.php with nginx server ?

how to use httpd .passwd protect wp-login.php with nginx server?

STEP 1. CREATE THE HTTPD PASSWORD FILE:

WITH THE ONLINE TOOL:

https://www.htaccesstools.com/htpasswd-generator/

STEP 2. CONFIG NGINX SERVER:

just add below code to the nginx .conf file ?

add httpd password ,

add the nginx php-fpm to wp-login.php , otherwise, the brower will directly download the .php file.

location /wp- admin/
{
auth_basic "WP-ADMIN";
auth_basic_user_file certs/.htpasswd;
autoindex on;
}

location =/wp- login.php {
auth_basic "PASSWORD NEED";
auth_basic_user_file certs/.htpasswd;
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

3.CHECK THE DEMO:

https://www.shopym.com

相关推荐

暂无评论

微信扫一扫,分享到朋友圈

how to config httpd .passwd protect wp-login.php with nginx server ?