nginx

Posted agang_19

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx相关的知识,希望对你有一定的参考价值。

安装htpasswd

htpasswd是Apache密码生成工具,nginx支持auth_basic认证,因此我门可以将生成的密码用于Nginx中,输入一行命令即可安装:yum -y install httpd-tools ,参数如下:

 

htpasswd -c ./passwd username

 

server{
    listen 80;
    server_name xxxx;

    location / {
        auth_basic "登陆验证";
        auth_basic_user_file /etc/nginx/passwd;
        proxy_pass http://127.0.0.1:9090/;
    }
}

  

以上是关于nginx的主要内容,如果未能解决你的问题,请参考以下文章