NGINX Authentication
Jump to navigation
Jump to search
Using PAM & HTTP Auth for reverse proxy
nginx -v nginx version: nginx/1.14.0 (Ubuntu)
nano /etc/pam.d/nginx
@include common-auth
In nginx site server config add
location /secure { auth_pam "My secured location"; auth_pam_service_name "nginx"; }
add permission for nginx user to /etc/shadow
sudo usermod -aG shadow www-data
Check /etc/nginx/nginx.conf for the account used for nginx www-data. It can sometimes be configured to nobody.
add user
adduser myuser --gecos ""
Handling Requests
https://stackoverflow.com/questions/40645270/nginx-auth-request-handler-accessing-post-request-body