独立web站点的快速部署

1案例1: 独立web站点的快速部署
1.1 问题

本例要求为http://server0.example.com配置web站点,要求如下:

  1. 从http://classroom/pub/materials/station.html下载一个主页文件,将其重命名为index.html
  2. 将此文件拷贝到站点的DocumentRoot目录下,不要对文件index.html的内容作任何修改
  3. 使用elinks或firefox浏览器上述web站点
1.2 方案

web网站服务端:软件包httpd、系统服务httpd
web网站浏览器:软件包elinks或firefox
传输协议及端口:TCP 80
web网站服务端配置文件:

  • /etc/httpd/conf/httpd.conf
  • /etc/httpd/conf.d/*.conf
    默认首页文件:index.html
    httpd网站文档的默认根目录:/var/www/html
    URL(Uniform Resource Locator,统一资源定位系统)网址的基本组成:
http://服务器地址[:端口号]/目录/文件名

对于需要验证的FTP资源,还需要指定用户名密码信息:

ftp://用户名:密码@服务器地址[:端口号]/目录/文件名
1.3 步骤

实现此啊你需要按照如下步骤进行。

步骤一:构建及部署网站服务器

1)安装软件包httpd

[root@server0 ~]# yum  -y  install  httpd
.. ..

2)部署网页

[root@server0 ~]# cd  /var/www/html/                       //进入网页目录
[root@server0 html]# wget  http://classroom/pub/materials/station.html  -O  index.html                                                  //下载网页
.. ..
2016-11-26 19:33:49 (1.36 MB/s) - ‘index.html’ saved [14/14]
[root@server0 html]# cat  index.html                      //检查网页文件
Default Site.

3)启动系统服务httpd,并设置开机自启

[root@server0 html]# systemctl  restart  httpd
[root@server0 html]# systemctl  enable  httpd
ln -s '/usr/lib/systemd/system/httpd.service' '/etc/systemd/system/multi-user.target.wants/httpd.service'

步骤二:访问网页服务器

1)使用elinks浏览器查看
Elinks浏览器可以在命令行模式显示出网页文本,经常用来测试网站的可用性。

[root@desktop0 ~]# yum  -y  install  elinks                      //安装elinks
.. ..
[root@desktop0 ~]# elinks  -dump  http://server0.example.com/     //访问指定网址
   Default Site.

2)使用firefox浏览器查看
Firefox浏览器支持更多网页特性,是访问复杂网页、网址的优秀工具。
在桌面终端直接运行“firefox http://server0.example.com/”,或者通过菜单快捷方式打开Firefox浏览器再输入对应网址,都可以看到目标网页(如图所示)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值