搭建web服务一
练习一
1.安装软件包
[root@lys ~]# yum install httpd httpd-manual
2.启动服务
[root@lys ~]# /etc/init.d/httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName
[确定]
[root@lys ~]# chkconfig httpd on
[root@lys ~]# chkconfig httpd --list
httpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
3.用client直接访问
http://192.168.102.123/
4.新建测试主页
[root@lys ~]# vim /var/www/html/index.html
[root@lys ~]# cat /var/www/html/index.html
<h> Hello lys , This is world !</h1>
5.上传模版网站并访问
[root@lys ~]# scp test01@*.*.*.*:~/test_web.zip .
[root@lys ~]# unzip test_web.zip -d /var/www/html/
Archive: test_web.zip
creating: /var/www/html/muban1/
……
[root@lys ~]# ls /var/www/html/
index.html muban1 muban2 muban3 muban4
练习二
1.修改主配置文件
[root@lys ~]# cd /etc/httpd/conf
[root@lys conf]# ls
httpd.conf magic
[root@lys conf]#cp httpd.conf httpd.conf.bak
[root@lys conf]# hostname
lys
[root@lys conf]# vim httpd.conf
276:#ServerName www.example.com:80
277:ServerName lys:80
293:#DocumentRoot "/var/www/html"
294:DocumentRoot "/test"
319:#<Directory "/var/www/html">
320:<Directory "/test">
[root@lys conf]# mv /var/www/html/* /test/
[root@lys conf]# ls /test/
index.html muban1 muban2 muban3 muban4
[root@lys conf]# /etc/init.d/httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
[root@lys conf]# mv /test/* /var/www/html/