In the Nginx configuration, just add the configuration
fastcgi_param $http-authorization if_not_empty HTTP_AUTHORIZATION;
so that the authentication variables are filled in.
On the PHP side, to retrieve them
$username - $_SERVER['PHP_AUTH_USER']; $password - $_SERVER['PHP_AUTH_PW'];
