RHCE_web服务器_http实验

1.安装httpd,并将访问apache服务器的首页修改为hello.html, 且内容为: "My Home Page is hello"

[root@wjy ~]yum install httpd -y

[root@wjy html]# vim /etc/httpd/conf/httpd.conf
[root@wjy html]# ls -l
total 8
-rw-r--r--. 1 root root 22 Jul 28 16:10 hello.html
-rw-r--r--. 1 root root 27 Jul 28 15:53 index.html
[root@wjy html]# echo "My Home Page is Hello" >hello.html
[root@wjy html]# systemctl restart httpd


2.虚拟主机:虚拟两台主机ip为100,200, 对应访问目录:/www/ip/100, /www/ip/200
            并创建首页文件index.html 

[root@wjy ~]# nmcli c modify ens160 +ipv4.addresses 192.168.139.100/24
[root@wjy ~]# nmcli c modify ens160 +ipv4.addresses 192.168.139.200/24

[root@wjy www]# mkdir /www/ip/{100,200} -p
[root@wjy ip]# echo "This is page for 100" > /www/ip/100/index.html
[root@wjy ip]# echo "This is page for 200" > /www/ip/200/index.html

[root@wjy ip]# cd /etc/httpd/conf.d/
[root@wjy conf.d]# vim myhosts.conf 

<Directory "/www/ip">
        AllowOverride None
        Require all granted
</Directory>

<VirtualHost 192.168.139.100:80>
        DocumentRoot "/var/www/ip/100"

</VirtualHost>

<VirtualHost 192.168.139.200:80>
        DocumentRoot "/var/www/ip/200"
</VirtualHost>
[root@wjy conf.d]# systemctl restart httpd
[root@wjy conf.d]# getenforce
Enforcing
[root@wjy conf.d]# setenforce 0
[root@wjy conf.d]# curl 192.168.139.100
This is page for 100
[root@wjy conf.d]# curl 192.168.139.200
This is page for 200


3.配置不同端口的虚拟主机访问apache服务器

[root@wjy conf.d]# mkdir /www/port/{8080,9090} -p
[root@wjy conf.d]# echo "this is page for port 8080" > /www/port/8080/index.html
[root@wjy conf.d]# echo "this is page for port 9090" > /www/port/9090/index.html

[root@wjy conf.d]# cd /etc/httpd/conf.d/
[root@wjy conf.d]# vim myhosts_port.conf
Listen 8080
Listen 9090
 
<Directory "/www/port/">
        AllowOverride None
        Require all granted
</Directory>
 
<VirtualHost 192.168.139.100:8080>
        DocumentRoot "/www/port/8080"
</VirtualHost>
<VirtualHost 192.168.139.100:9090>
        DocumentRoot "/www/port/9090"
</VirtualHost>
[root@wjy conf.d]# systemctl restart httpd
[root@wjy conf.d]# curl 192.168.139.100:8080
this is page for port 8080
[root@wjy conf.d]# curl 192.168.139.100:9090
this is page for port 9090

4.可选:SSL握手协议发送哪些包,分几个阶段

 在这里插入图片描述

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值