搭建web服務一

練習一

1.安裝軟件包html

[root@lys ~]# yum install httpd httpd-manualweb

2.啓動服務vim

[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
[肯定]dom

[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/spa

 

4.新建測試主頁3d

[root@lys ~]# vim /var/www/html/index.html
[root@lys ~]# cat /var/www/html/index.html
<h> Hello lys , This is world !</h1>rest

5.上傳模版網站並訪問server

[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/

 

相關文章
相關標籤/搜索