更新时间:2022-09-27 11:38:16
1
|
yum -y install nginx
|
nginx部分配置文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html ;
# Load configuration files for the default server block.
include /etc/nginx/default .d/*.conf;
location / {
auth_basic "elk" ;
auth_basic_user_file /etc/nginx/htpasswd ;
}
error_page 404 /404 .html;
location = /40x .html {
}
error_page 500 502 503 504 /50x .html;
location = /50x .html {
}
}
|
1
2
3
4
|
[root@l2tp html] # htpasswd -cb /etc/nginx/htpasswd liuhx 123456
Adding password for user liuhx
[root@l2tp html] # cat /etc/nginx/htpasswd
liuhx:$apr1$qoRxZ3ly$0PTCsKkfyujESjb8Twdj9/ |
1
2
|
[root@l2tp html] # echo "test 加密"> /usr/share/nginx/html/index.html
[root@l2tp html] #
|
1
2
|
nginx -t nginx |