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验证
raksmart作为一家老牌美国机房总是被很多人问到raksmart香港服务器怎么样、raksmart好不好?其实,这也好理解。香港服务器离大陆最近、理论上是不需要备案的服务器里面速度最快的,被过多关注也就在情理之中了。本着为大家趟雷就是本站的光荣这一理念,拿了一台raksmart的香港独立服务器,简单做个测评,分享下实测的数据,仅供参考!官方网站:https://www.raksmart.com...
OneTechCloud(易科云)是一家主打CN2等高端线路的VPS主机商家,成立于2019年,提供的产品包括VPS主机和独立服务器租用等,数据中心可选美国洛杉矶、中国香港、日本等,有CN2 GIA线路、AS9929、高防、原生IP等。目前商家针对全场VPS主机提供月付9折,季付8折优惠码,优惠后香港VPS最低季付64元起(≈21.3元/月),美国洛杉矶CN2 GIA线路+20Gbps防御型VPS...
webhosting24决定从7月1日开始对日本机房的VPS进行NVMe和流量大升级,几乎是翻倍了硬盘和流量,当然前提是价格依旧不变。目前来看,国内过去走的是NTT直连,服务器托管机房应该是CDN77*(也就是datapacket.com),加上高性能平台(AMD Ryzen 9 3900X+NVMe),这样的日本VPS还是有相当大的性价比的。官方网站:https://www.webhosting...