WordPress Extra Authentication

Nginx snippets adding extra basic auth to wordpress.

    location ~ ^/(xmlrpc|wp-.+)/?.*\.php$ {
        auth_basic "hahaha";
        auth_basic_user_file "/etc/nginx/sskaje.auth";

        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_index index.php;
        include fastcgi.conf;

        fastcgi_intercept_errors on;
    }

Create Password File

htpasswd -c /etc/nginx/sskaje.auth sskaje

Add User

htpasswd /etc/nginx/sskaje.auth sskaje

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *