Convert .htaccess http authorization to nginx

Alex Petrov asked:

I need to convert the following .htaccess string to nginx config:

RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]

Can anyone help me?

I’m running nginx + php_fpm configuration.

My answer:


Add to your PHP location block, or to your global fastcgi_params which it includes:

fastcgi_param REMOTE_USER $remote_user;

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.