Nginx gives an Internal Server Error 500 after I have configured basic auth

前端 未结 11 2800
盖世英雄少女心
盖世英雄少女心 2020-12-16 11:29

I am trying to do basic auth on Nginx. I have version 1.9.3 up and running on Ubuntu 14.04 and it works fine with a simple html file.

Here is the html file:

11条回答
  •  醉话见心
    2020-12-16 11:48

    I will just stick the htpassword file under "/etc/nginx" myself. Assuming it is named htcontrol, then ...

    sudo htpasswd -c /etc/nginx/htcontrol calvin

    Follow the prompt for the password and the file will be in the correct place.

    location / {
        ...
    
        auth_basic "Restricted";
        auth_basic_user_file htcontrol;
    }
    

    or auth_basic_user_file /etc/nginx/htcontrol; but the first variant works for me

提交回复
热议问题