RHCE练习 apache服务器

本文档详细介绍了如何安装和配置Apache服务器,包括将默认首页更改为'hello.html',设置虚拟主机以根据不同的IP地址访问不同的目录,以及配置不同端口的虚拟主机。此外,还提供了SSL握手协议的基本理解链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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

1.安装httpd

yum install httpd -y

2.建立hello.html文件

echo "My Home Page is hello" > /var/www/html/hello.html

3.配置httpd.conf文件

vim /etc/httpd/conf/httpd.conf

在index.html前加上hello.html  就会先寻找hello.html文件再找index.html文件

<IfModule dir_module>
    DirectoryIndex hello.html index.html
</IfModule>

4.重启服务,停用防火墙

systemctl restart httpd

systemctl stop firewalld

setenforce 0

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

1.新建两个ip

nmcli c modify ens160 +ipv4.addresses 192.168.86.100/24

nmcli c modify ens160 +ipv4.addresses 192.168.86.200/24

nmcli c up ens160

2.然后创建对应目录,并定义网页内容

mkdir /www/ip{100,200} -p

echo "This is page for 100" > /www/ip/100/index.html

echo "This is page for 200" > /www/ip/200/index.html

3.接下来定义配置文件/etc/httpd/conf.d/myhost.conf

vim /etc/httpd/conf.d/myhost.conf
<VirtualHost 192.168.86.100:80>
    DocumentRoot /www/ip/100
    ServerName 192.168.86.100
</VirtualHost>

<VirtualHost 192.168.86.200:80>
    DocumentRoot /www/ip/200
    ServerName 192.168.86.200
</VirtualHost>

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

4.重启服务,停用防火墙和selinux

systemctl restart httpd

systemctl stop firewalld

setenforce 0

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

1.创建对应目录,并定义网页内容

mkdir /www/port{9090,9091} -p

echo "This is page for 9090" > /www/port/9090/index.html

echo "This is page for 9091" > /www/port/9090/index.html

2.定义配置文件/etc/httpd/conf.d/myhost.conf

vim /etc/httpd/conf.d/myhost.conf

3.重启服务,停用防火墙和selinux

systemctl restart httpd

systemctl stop firewalld

setenforce 0

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

这个链接里写的很不错

https://www.fisec.cn/1209.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值