7.26作业

本文详细介绍了如何在Linux服务器上安装Apache,设置首页为自定义内容,配置虚拟主机以区分不同IP地址和端口,并创建对应的网页。涉及的内容包括httpd安装、Apache首页修改、IPv4地址分配、虚拟主机配置以及不同端口的访问设置。

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

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

[root@server conf.d]# yum install httpd -y
[root@server conf.d]# rpm -al httpd
[root@server html]# vim index.html


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

[root@server html]# nmcli connection modify ens160 +ipv4.addresses 192.168.111.100/24
[root@server html]# nmcli connection modify ens160 +ipv4.addresses 192.168.111.200/24
[root@server html]# nmcli connection up ens160 
[root@server ~]# echo "this is page for 100" > /www/ip/100/index.html
[root@server ~]# echo "this is page for 200" > /www/ip/100/index.html

配置虚拟主机


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

[root@server prot]# ls -l
total 0
drwxr-xr-x. 2 root root 6 Jul 27 18:19 80
drwxr-xr-x. 2 root root 6 Jul 27 18:19 90
[root@server prot]# echo the port is 80 > /www/prot/80/index
[root@server prot]# echo the port is 90 > /www/prot/80/index

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值