RHCE试题EX300详解-配置虚拟主机
题目要求配置虚拟主机
在se rve r0上扩展您的WE B服务器为站点http://webapp0.example.com创建一个虚拟主机。
l设置DocumentRoot为/var/www/virtual
l从http://classroom.example.com/content/extend.html下载文件 l并重命名为index.html丌要对文件index.html的内容做任何修改 l将文件index.html放到虚拟机的DocumentRoot目录下
l确保f loyd用户能够在/va r/www/virtua l 目录下创建文件
注意原始站点http://www0.example.com必须仍然能够访问
名称服务器classroom.example.com提供对主机名webapp0.example.com的域名解析
知识点小贴士
Apac he服务器可利用虚拟主机功能在一台服务器上设置多个Web站点Apac he支持两种类型的虚拟主机基于IP地址的虚拟主机和基于域名的虚拟主机。基于IP地址的各虚拟主机使用同一IP地址的丌同端口或者是使用丌同的IP地址。用户可直接使用IP地址来访问此类虚拟主机。
解题步骤
1查看主机名解析
[root@server0 ~] #hostwebapp0 .example.comwebapp0.example.comisanaliasforserver0.exa mple.com.server0 .example.comhasaddress 172.25.0.11
2根据题意创建目录并设置权限
[root@server0 ~] # mkdir /var/www/virtual
[root@server0 ~] # setfacl -m u:floyd:rwx /var/www/virtual/3下载文件到指定目录
[root@server0~]#wget-O/var/www/virtual/index.htmlhttp://classroom .example.com/content/extend.html--2020-03-2608:12:23-- http://cl assroom.example.com/content/extend.htmlResolvingclassroom.example .com(classroom.example.com) . . . 172.25.254 .254Connectingtoclassroom .example.com(classroom.example.com) |172.25.254.254 | :80. . .connecte d.HTTPrequestsent,awaitingresponse. . .200OKLength:8 [text/html]Savi ng to: ‘/var/www/virtual/index.html’100%[=====================>] 8
--.-K/s in0s 2020-03-2608 :12:24 (348KB/s) -‘/var/www/v irtual/index.html’saved[8/8] [root@server0~]#lsdZ/var/www/html/ /var/www/virtual/ls: cannot access dZ:Nosuchfileordirectory/var/www/html/ :index.html/var/www/virtual /:index.html
4编辑配置文件
autoindex.conf vhos-server0-ssl.conf
README vhost-server0.conf
ssl.conf welcome.conf userdir.conf
[root@server0 ~] # vim /etc/httpd/conf.d/webapp0.conf
webapp0.conf配置文件
注释
<VirtualHost *:80>
DocumentRoot"/var/www/virtual"servername webapp0.example.com</VirtualHost>
(5)重启httpd服务
6验证
Virtono最近推出了夏季促销活动,为月付、季付、半年付等提供9折优惠码,年付已直接5折,而且下单后在LET回复订单号还能获得双倍内存,不限制付款周期。这是一家成立于2014年的国外VPS主机商,提供VPS和服务器租用等产品,商家支持PayPal、信用卡、支付宝等国内外付款方式,可选数据中心包括罗马尼亚、美国洛杉矶、达拉斯、迈阿密、英国和德国等。下面列出几款VPS主机配置信息,请留意,下列配置中...
PIGYun是成立于2019年的国人商家,提供香港、韩国和美西CUVIP-9929等机房线路基于KVM架构的VPS主机,本月商家针对韩国首尔、美国洛杉矶CUVIP-AS29、GIA回程带防御等多条线路VPS提供6-8.5折优惠码,优惠后韩国首尔CN2混合BGP特惠型/美国洛杉矶GIA回程带10Gbps攻击防御VPS主机最低每月14.4元起。下面列出几款不同机房VPS主机配置信息,请留意不同优惠码。...
zoecloud怎么样?zoecloud是一家国人商家,5月成立,暂时主要提供香港BGP KVM VPS,线路为AS41378,并有首发永久8折优惠:HKBGP20OFF。目前,解锁香港区 Netflix、Youtube Premium ,但不保证一直解锁,谢绝以不是原生 IP 理由退款。不保证中国大陆连接速度,建议移动中转使用,配合广州移动食用效果更佳。点击进入:zoecloud官方网站地址zo...