774530750 发表于 2018-11-10 06:38:46

实战Nginx web用户认证

# curl -I -xlocalhost:80 www.123.cn  HTTP/1.1 200 OK
  Server: nginx
  Date: Mon, 12 Mar 2018 15:29:32 GMT
  Content-Type: text/html;
  Connection: keep-alive
  Vary: Accept-Encoding
  X-Powered-By: PHP/5.6.34
  # curl -I -xlocalhost:80 www.123.cn/admin/
  HTTP/1.1 401 Unauthorized
  Server: nginx
  Date: Mon, 12 Mar 2018 15:29:40 GMT
  Content-Type: text/html
  Content-Length: 188
  Connection: keep-alive
  WWW-Authenticate: Basic realm="Auth"
  # curl -I -xlocalhost:80 www.123.cn/admin/index.php
  HTTP/1.1 401 Unauthorized
  Server: nginx
  Date: Mon, 12 Mar 2018 16:09:12 GMT
  Content-Type: text/html
  Content-Length: 188
  Connection: keep-alive
  WWW-Authenticate: Basic realm="Auth"
  # curl -I -xlocalhost:80 www.123.cn/admin/tz.php
  HTTP/1.1 401 Unauthorized
  Server: nginx
  Date: Mon, 12 Mar 2018 16:09:27 GMT
  Content-Type: text/html
  Content-Length: 188
  Connection: keep-alive
  WWW-Authenticate: Basic realm="Auth"
  # curl -I -xlocalhost:80 www.123.cn/admin/ -uaiker
  Enter host password for user 'aiker':
  HTTP/1.1 200 OK
  Server: nginx
  Date: Mon, 12 Mar 2018 15:29:49 GMT
  Content-Type: text/html; charset=UTF-8
  Connection: keep-alive
  Vary: Accept-Encoding
  X-Powered-By: PHP/5.6.34

页: [1]
查看完整版本: 实战Nginx web用户认证