正在加载图片...
《 Linux操作系统》实验指导书/实验三:网站服务器 ##第一个网站使用80端口,其网站使用域名为www.yl.com Servernamewww.yi.com DocumentRoot /var/www/html <Directory "/var/www/html"> AllowOverride All Require all granted </Directory> Server Admin root@localhost ##第二个网站使用80端口,其网站使用域名为 ww. two co Servernamewww.two.com DocumentRoot /var/www/html irectory /var/www/html1"> Options FollowSymLinks AllowOverride All Require all granted </irtualHost> ②服务重启 完成配置文件编辑后,需重启htd服务,其操作命令如下 #fsystemctlrestarthttpd ③ hosts配置 编辑本地 hosts文件,其文件路径为 C: Windows System32 \driversletc\hosts, hosts文件 增加内容如图3-12所示。 2172.16.124.18 yI. com 3172.16.124.187www,tw.cm 图3-12修改本地 hosts文件 ④测试访问 在本地浏览器中分别输入两个网站的地址:htp/www.yi.com/test.html、htp/www.two. com/ test htm,验证域名发布网站是否生效,访问结果如图3-13、3-14所示。 <cowww.yi.com/test.html 这是第一个网页 图3-13通过Www.yl.com域名访问 two. com/testhtml 这是第二个网页 图3-14通过www.two.com域名访问 管理科学与工程学科/阮晓龙/13938213680/共11页,第7页《Linux 操作系统》实验指导书 / 实验三:网站服务器 管理科学与工程学科 / 阮晓龙 / 13938213680 / 共 11 页,第7页 ##第一个网站使用 80 端口,其网站使用域名为 www.yi.com ServerName www.yi.com DocumentRoot /var/www/html <Directory "/var/www/html"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin root@localhost ##第二个网站使用 80 端口,其网站使用域名为 www.two.com ServerName www.two.com DocumentRoot /var/www/html1 <Directory "/var/www/html1"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> ②服务重启 完成配置文件编辑后,需重启 httpd 服务,其操作命令如下。 # systemctl restart httpd ③hosts 配置 编辑本地 hosts 文件,其文件路径为 C:\Windows\System32\drivers\etc\hosts,hosts 文件 增加内容如图 3-12 所示。 ④测试访问 在本地浏览器中分别输入两个网站的地址:http://www.yi.com/test.html、http://www.two. com/test.html,验证域名发布网站是否生效,访问结果如图 3-13、3-14 所示。 图 3-13 通过 www.yi.com 域名访问 图 3-14 通过 www.two.com 域名访问 图 3-12 修改本地 hosts 文件
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有