1、挂载:
[root@localhost hh]# mount /dev/sr0 /mnt
2、配置yum源
[root@localhost hh]# vim /ect/yum.repos.d/base.repo
[base] name=base baseurl=file:///mnt/BaseOS gpgcheck=0 [app] name=app baseurl=file:///mnt/AppStream gpgcheck=0
3、装包
[root@localhost hh]# dnf install httpd -y
4、关闭防火墙和SELinux
[root@localhost hh]# systemctl stop firewalld
[root@localhost hh]# setenforce 0
5
<VirtualHost 192.168.142.130:80>
Servername www.openlab.com
DocumentRoot /www/openlab
</VirtualHost>
<Directory /www/>
AllowOverride none
Require all granted
</Directory>
6、利用本机的/etc/hosts文件做域名解析
[root@localhost ~]# vim /etc/hosts
192.168.113.131 www.openlab.com
7、创建网页根目录
[root@localhost ~]# mkdir -p /www/openlab
8、根据配置创建网页资源文件
[root@localhost ~]# echo 'welcome to openlab!!!' > /www/openlab/index.html
9、重启hppd服务
[root@localhost ~]# systemctl restart httpd
[root@localhost ~]# setenforce 0
10、主机测试
[root@localhost ~]# curl www.openlab.com
welcome to openlab!!!
二
1、创建目录
[root@localhost etc]# cd /root
[root@localhost ~]# mkdir {student,data,money}
修改权限:[root@localhost ~]# chmod /root 777
2、添加内容
[root@localhost ~]# echo who is money > /root/money/index.html
[root@localhost ~]# echo who is data > /root/data/index.html
[root@localhost ~]# echo who is student > /root/student/index.html
三
1、挂载光盘到/mnt
[root@localhost ~]# mount /dev/sr0 /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
2、下载mod_ssl 软件包
[root@localhost ~]# yum install mod_ssl -y
3、制作秘钥及证书
[root@localhost ~]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout /etc/pki/tls/private/openlab.key -x509 -days 365 -out /etc/pki/tls/certs/openlab.crt
Generating a RSA private key
4、更改配置文件
[root@localhost ~]# vim /etc/httpd/conf.d/vshots.conf
<VirtualHost 192.168.101.200:443>
DocumentRoot /www/openlab
Alias /money /www/openlab/money
ServerName www.openlab.com
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/openlab.crt
SSLCertificateKeyFile /etc/pki/tls/private/openlab.key
</VirtualHost>
5、创建网页文件根目录
[root@localhost ~]# mkdir /www/openlab/money
6、编辑子网页money内容
[root@localhost ~]# echo 'this is openlab money' > /www/openlab/money/index.html
7、重启httpd服务
[root@localhost ~]# systemctl restart httpd
8、Client主机测试
[root@localhost ~]# curl --insecure https://www.openlab.com/money/
this is openlab money
9、money子页面更改配置文件
[root@server ~]# vim /etc/httpd/conf.d/vshots.conf
10、创建用户 指定用户名及密码
[root@localhost ~]# htpasswd -c /etc/httpd/userfile song
[root@server ~]# htpasswd /etc/httpd/userfile tian