Home  >  Article  >  Operation and Maintenance  >  How to implement nginx authentication

How to implement nginx authentication

WBOY
WBOYforward
2023-05-21 10:04:051482browse

Install httpd

yum install

Use htpasswd to produce password files

htpasswd -c /usr/local/nginx/conf/htpasswd aming
# -c 表示创建文件, aming是用户名
# 当添加用户时,需要去掉 -c 参数
# 修改密码的方式和添加用户的方式相同

Configure nginx user authentication

location  /admin/
  {
      auth_basic              "Auth";
      auth_basic_user_file   /usr/local/nginx/conf/htpasswd;
  }

The above is the detailed content of How to implement nginx authentication. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete