![使用 nginx htpasswd 保护 WordPress 登录,防止 woocommerce 注销](https://linux22.com/image/785588/%E4%BD%BF%E7%94%A8%20nginx%20htpasswd%20%E4%BF%9D%E6%8A%A4%20WordPress%20%E7%99%BB%E5%BD%95%EF%BC%8C%E9%98%B2%E6%AD%A2%20woocommerce%20%E6%B3%A8%E9%94%80.png)
我已经使用 nginx 中的 htpasswd保护了我/wp-admin/
的。wp-login.php
这是 .conf 文件
server {
listen [::]:443 ssl http2;
listen 443 ssl http2;
server_name www.url;
access_log /var/log/nginx/url.access.log;
error_log /var/log/nginx/url.error.log;
client_max_body_size 16M;
large_client_header_buffers 4 32k;
# live system
root /var/www/prod-domain;
index index.php;
# in case of maintenance use this directory
# root /var/www/maintenance;
# index index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
# protect admin area
location /wp-admin/ {
auth_basic "Backend Login";
auth_basic_user_file /var/www/.htpasswd;
}
# allow file from admin area for frontend login/registration
location /wp-admin/js/password-strength-meter.min.js {
satisfy any;
allow all;
}
# also protect wp-login file
location = /wp-login.php {
auth_basic "Backend Login";
include snippets/fastcgi-php.conf;
auth_basic_user_file /var/www/.htpasswd;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
问题:如果您想以客户身份在 woocommerce 中注销,则无法注销。注销过程还使用 wp-login.php,浏览器会提示 htpasswd 的登录屏幕
我可以排除该进程以允许注销吗?
看起来像:
wp-login.php?action=logout&redirect_to=https%3A%2F%2Fwww.url%2Fmein-konto%2F&_wpnonce=78d2a420af