1:Test environment
[root@linux-node1 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@linux-node1 ~]# uname -r
3.10.0-862.el7.x86_64
[root@linux-node1 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
[root@linux-node1 ~]# hostname -I
192.168.99.24
2: Nginx Installation
[root@linux-node1 ~]# yum -y install nginx
[root@linux-node1 ~]# systemctl start nginx.service
[root@linux-node1 ~]# systemctl enable nginx.service
3:Configuration
[root@linux-node1 ~]# cp /etc/nginx/nginx.conf{,.bck}
[root@linux-node1 ~]# egrep -v "#|^$" /etc/nginx/nginx.conf.bck > /etc/nginx/nginx.conf
[root@linux-node1 ~]# cat -n /etc/nginx/nginx.conf
28 location / {
29 autoindex on;
30 autoindex_exact_size off;
31 autoindex_localtime on;
32 }
[root@linux-node1 ~]# cd /usr/share/nginx/html/
[root@linux-node1 html]# ls
404.html 50x.html index.html nginx-logo.png poweredby.png
[root@linux-node1 html]# rm -rf *
[root@linux-node1 html]# ls
Anti-Fire Trainning CCTV News Daily Documents
4: http://192.168.99.24
autoindex on;
autoindex_exact_size off;
默认为on,显示出文件的确切大小,单位是bytes。
改为off后,显示出文件的大概大小,单位是kB或者MB或者GB
autoindex_localtime on;
默认为off,显示的文件时间为GMT时间。
改为on后,显示的文件时间为文件的服务器时间
-----
[root@linux-node1 ~]# htpasswd --help
Usage:
htpasswd [-cimBdpsDv] [-C cost] passwordfile username
htpasswd -b[cmBdpsDv] [-C cost] passwordfile username password
htpasswd -n[imBdps] [-C cost] username
htpasswd -nb[mBdps] [-C cost] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-b Use the password from the command line rather than prompting for it.
-i Read password from stdin without verification (for script usage).
-m Force MD5 encryption of the password (default).
-B Force bcrypt encryption of the password (very secure).
-C Set the computing time used for the bcrypt algorithm
(higher is more secure but slower, default: 5, valid: 4 to 31).
-d Force CRYPT encryption of the password (8 chars max, insecure).
-s Force SHA encryption of the password (insecure).
-p Do not encrypt the password (plaintext, insecure).
-D Delete the specified user.
-v Verify password for the specified user.
On other systems than Windows and NetWare the '-p' flag will probably not work.
The SHA algorithm does not use a salt and is less secure than the MD5 algorithm.
----xilong_devops@163.com----