Report this

What is the reason for this report?

Nginx Basic Auth not working

Posted on March 26, 2020

I’m trying to add basic auth for wp-login but it is not working

Here is the code I have added to /etc/nginx/sites-available/default file

        location ^~ /wp-login.php {
          auth_basic  "Admin Login";
          auth_basic_user_file /var/www/html/.htpasswd;
          fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
          fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
       }
          location /wp-admin/admin-ajax.php {
           allow all;
    }

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.