[root@localhost ~]#vim /etc/httpd/conf.d/host.conf <VirtualHost 192.168.117.129:80> ServerName www.openlab.com DocumentRoot /openlab </VirtualHost> <VirtualHost 192.168.117.129:443> ServerName www.openlab.com DocumentRoot /openlab SSLEngine on SSLCertificateFile /etc/pki/tls/certs/openlab.crt SSLCertificateKeyFile /etc/pki/tls/private/openlab.key </VirtualHost> <directory /openlab> AllowOverride none Require all granted </directory> <directory openlab/student> AllowOverride none AuthType Basic AuthName "Please input..." AuthUserFile /etc/httpd/users Require user song tian </directory> [root@localhost ~]# vim /etc/httpd/conf.d/host.conf [root@localhost ~]# vim /etc/httpd/conf.d/host.conf [root@localhost ~]# mkdir /openlab [root@localhost ~]# cd /openlab [root@localhost openlab]# mkdir student data money [root@localhost openlab]# ll 总用量 0 drwxr-xr-x. 2 root root 6 7月 8 21:19 data drwxr-xr-x. 2 root root 6 7月 8 21:19 money drwxr-xr-x. 2 root root 6 7月 8 21:19 student [root@localhost openlab]# echo welcome to openlab!!! > index.html [root@localhost openlab]# echo student > student/index.html [root@localhost openlab]# echo data > data/index.html [root@localhost openlab]# echo money > money/index.html [root@localhost httpd]# htpasswd users -c song [root@localhost httpd]# htpasswd users tian [root@localhost httpd]# htpasswd users ming [root@localhost httpd]#systemctl restart httpd [root@localhost tls]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout private/openlab.key -x509 -days 365 -out certs/openlab.crt Generating a RSA private key