nginx 配置认证
-c:创建一个加密文件;
-n:不更新加密文件,只将加密后的用户名密码显示在屏幕上;
-m:默认采用MD5算法对密码进行加密;
-d:采用CRYPT算法对密码进行加密;
-p:不对密码进行进行加密,即明文密码;
-s:采用SHA算法对密码进行加密;
-b:在命令行中一并输入用户名和密码而不是根据提示输入密码;
-D:删除指定的用户
### 添加用户
htpasswd -bc whitelist ops_user 1q2w3e
### 新增用户
htpasswd -b whitelist test 123456
### 删除用户
htpasswd -D whitelist test
### 修改用户密码
htpasswd -b whitelist ops_user 123qwe
satisfy any;
include /etc/nginx/whitelist;
deny all; auth_basic "Closed Site!";
# auth_basic_user_file /etc/nginx/htpasswd;
error_page 403 /40x-sprout.html;
location = /40x-sprout.html {
allow all;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
whitelist
##2020-09-10
allow 123.108.109.140;
## 2020-09-09
allow 103.240.203.138;
## 2020-08-26
allow 123.108.109.142;
## 2020-07-29
allow 202.60.255.139;
# 2020-07-22
allow 58.33.96.219;
## 2020-01-16
401.html
cat 401.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<h1>403 Forbidden</h1>
<p>You don't have permission to access the URL on this server. Sorry for the inconvenience.<br/>
Non-office network or VPN export IP, please Enterprise WeChat Contact <a target = "_blank" href="wxwork:https://work.weixin.qq.com/u/1vc61041e4dcf7f5350" title="Click View Site " > light&ezbuy </a> ,Ops <a target = "_blank" href="https://www.tapd.cn/20257541/prong/stories/1stories_list" title="Click View Site " > light-Ops.</a>
<!--Non-office network or VPN export IP, please Enterprise WeChat Contact <a target = "_blank" href="wxwork://message?uin=1688850522843493&source=21" title="Click View Site " > zhiyiz&wangl</a> ,Ops <a target = "_blank" href="https://www.tapd.cn/20257541/prong/stories/1stories_list" title="Click View Site " > light-Ops.</a> -->
<br/>
<br/><a href="mailto:skydong@light.com"> R&D application engineer Email</a>
<br/><a href="mailto:ops_notice@light.com"><font size="3"> Site Reliability Engineering Email</a>
<!--<br/><a href="mailto:ops_notice@light.com"><font size="3"> Operation engineer Email</a>
This is a our test website, please visit our official website <a href="http://skydong.com/contact/index.html" title="Click View Site " ><font size="5"> www.skydong.com</a>! -->
</font><br/>
Thank you very much!</p>
URL: http://cachef-co1.ezbuy.me
<br/>Date:
<script language="JavaScript" type="text/javascript">
var enabled = 0; today = new Date();
var date;
M=today.getMonth() + 1
D=today.getDate()
HH=today.getHours()
MM=today.getMinutes()
SS=today.getSeconds()
if (M<10)
{
M="0"+M
}
if (D<10)
{
D="0"+D
}
if (MM<10)
{
MM="0"+MM
}
if (HH<10)
{
HH="0"+HH
}
if (SS<10)
{
SS="0"+SS
}
date = (today.getFullYear()) + "/" + M + "/" + D + " " + HH+":"+MM+":"+SS +"";
document.write(date);
</script>
<hr/>Powered by light-ops!</body>
</html>
40x-xxx.html
cat /usr/local/openresty/nginx/html/40x-sprout.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<h1>403 Forbidden</h1>
<p>You don't have permission to access the URL on this server. Sorry for the inconvenience.<br/>
Non-office network and VPN export IP, please Enterprise WeChat Contact <a target = "_blank" href="wxwork:https://work.weixin.qq.com/u/vc61041e4dcf7f5350" title="Click View Site " > zhiyiz&wanglei</a> ,Ops <a target = "_blank" href="https://www.tapd.cn/20257541/prong/stories/stories_list" title="Click View Site " > light-Ops.</a>
<!--Non-office network and VPN export IP, please Enterprise WeChat Contact <a target = "_blank" href="wxwork://message?uin=1688850522843493&source=2" title="Click View Site " > zhiyizhao&wanglei</a> ,Ops <a target = "_blank" href="https://www.tapd.cn/20257541/prong/stories/stories_list" title="Click View Site " > light-Ops.</a> -->
<br/>
<br/><a href="mailto:zhiyiz@lightinthebox.com"> R&D application engineer Email</a>
<br/><a href="mailto:ops_noti@lightinthebox.com"><font size="3"> Site Reliability Engineering Email</a>
<!--<br/><a href="mailto:ops_noti@lightinthebox.com"><font size="3"> Operation engineer Email</a>
This is a our test website, please visit our official website <a href="http://skydong.com/contact/index.html" title="Click View Site " ><font size="5"> www.skydong.com</a>! -->
</font><br/>
Thank you very much!</p>
URL: http://sprout.65eamll1.net
<br/>Date:
<script language="JavaScript" type="text/javascript">
var enabled = 0; today = new Date();
var date;
M=today.getMonth() + 1
D=today.getDate()
HH=today.getHours()
MM=today.getMinutes()
SS=today.getSeconds()
if (M<10)
{
M="0"+M
}
if (D<10)
{
D="0"+D
}
if (MM<10)
{
MM="0"+MM
}
if (HH<10)
{
HH="0"+HH
}
if (SS<10)
{
SS="0"+SS
}
date = (today.getFullYear()) + "/" + M + "/" + D + " " + HH+":"+MM+":"+SS +"";
document.write(date);
</script>
<hr/>Powered by sprout.elitb.com!</body>
</html>