Setting up basic authentication in Nginx is pretty easy, you need to first add couple of directives in block config, you can out them directly in the server if you want the whole site not be accessible or just on some parts-
auth_basic "Restricted Content";
Then in the .htpasswd file add the user and use openssl to generate hash for the chosen password –
echo "password" | openssl passwd -apr1 -stdin
One of the reasons for this and nothing in the logs might be newer version of Nginx which and you will have to replace in your configuration
Another problem is that you might need to add
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
in /etc/nginx/fastcgi_params , might be called also /etc/nginx/fastcgi.conf
It can also be added where your php setting block in Nginx is.
Might expand the post in the future with other possible reasons.