2、建立httpd服务器,要求提供两个基于名称的虚拟主机:
(1)www.X.com,页面文件目录为/web/vhosts/x;错误日志为
/var/log/httpd/x.err,访问日志为/var/log/httpd/x.access
(2)www.Y.com,页面文件目录为/web/vhosts/y;错误日志为 /var/log/httpd/www2.err,访问日志为/var/log/httpd/y.access
(3)为两个虚拟主机建立各自的主页文件index.html,内容分别为其对应的主机名
-->安装httpd:
yum -y install httpd
mkdir -p /web/vhosts/{x,y}
启动:systemctl start httpd
-->基于不同ip实现:
ip addr add 192.168.10.104/24 broadcast 192.168.10.255 dev ens33 --添加ip地址
-->更改配置文件:
-->重启服务:验证:
-->验证日志:
文件都创建成功;
原文:https://blog.51cto.com/14688684/2500488