http实验三(对着实验书做,有些没做到这里)

不用配置直接启动

systemctl start named

安装http

yum install httpd

配置httpd

vi /etc/httpd/conf/httpd.conf

直接找到ServerName改为

ServerName dns.example.com:80

打开

vim /var/www/html/index.html

输入helloword测试

systemctl restart httpd

测试网址:在Linux和window测试(可能会扣分)

http://www.example.com

如果没有显示hellword试一下

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT 
vim /etc/httpd/conf/httpd.conf

跳到3.26,在下面添加

NameVirtualHost 172.18.111.203

<VirtualHost abc.example.com>
	ServerAdmin admin@example.com
	DocumentRoot "/var/www/web3" 	
	ServerName abc.example.com
	DirectoryIndex index.html	
	ErrorLog logs/web3/error_log
	CustomLog logs/web3/access_log common
</VirtualHost>
<VirtualHost xyz.example.com>
	ServerAdmin admin@example.com
	DocumentRoot "/var/www/web4"
	ServerName xyz.example.com
	DirectoryIndex index.html
	ErrorLog logs/web4/error_log
	CustomLog logs/web4/access_log combined
</VirtualHost>

正向配置name文件

vim /var/named/data/example.com.zone

内容在下面添加

abc 	IN 		A 		172.18.111.203
xyz 	IN 		A 		172.18.111.203

反向

vim /var/named/data/172.18.111.arpa

添加

203 		PTR     abc.example.com. 
			PTR     xyz.example.com.
ifconfig ens33:3 172.18.111.203 netmask 255.255.255.0
systemctl restart named
mkdir -p /var/www/web4
mkdir -p /var/www/web3
vim /var/www/web4/index.html

输入 hello web4

vim /var/www/web3/index.html
mkdir -p /etc/httpd/logs/web3
mkdir -p /etc/httpd/logs/web4
touch /etc/httpd/logs/web3/error_log
touch /etc/httpd/logs/web3/access_log
touch /etc/httpd/logs/web4/error_log
touch /etc/httpd/logs/web4/access_log


systemctl restart httpd
yum install nscd -y
systemctl restart nscd

分别在 Windows 和 Linux 的浏览器测试

http://abc.example.com
http://xyz.example.com
wget http://xyz.example.com
cat /etc/httpd/logs/web4/access_log
cat /etc/httpd/logs/web3/access_log
wget http://abc.example.com
cat /etc/httpd/logs/web3/access_log
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

龙龙啊啊啊啊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值