8/1/12

CẤU HÌNH HOSTING WEBSITE


1.1.1.     CẤU HÌNH HOSTING WEBSITE

Mô hình và yêu cầu bài tập

Hướng dẫn thực hiện

a.      Cấu hình Apache web server
1)     Khai báo NameVirtualHost
2)     Khai báo Virtualhost
b.      Reload web service
c.      Kiểm tra

Các bước thc hin

a)   Khai báo DNS Server
$TTL86400
@           IN    SOA   dns1.serverlinux.vn.root.     serverlinux.vn. (
                        2011022700 ; Serial
                        28800; Refresh
                        14400; Retry
                        3600000; Expire
                        86400 ); Minimum
            IN    NS    dns1.serverlinux.vn.
            IN    MX    10dns1.serverlinux.vn.
dns1 IN    A     192.168.1.17
www   IN    A     192.168.1.18
mail  IN    CNAME dns.serverlinux.vn.
ftp   IN    CNAME dns.serverlinux.vn.
proxy IN    CNAME dns.serverlinux.vn.
www.pcm     IN    A     192.168.1.18
www.itdep   IN    A     192.168.1.18
b)  Khởi động DNS Server
[root@localhost ~]# /etc/init.d/named restart
Stopping named:                                  [  OK  ]
Starting named:                                 [  OK  ]
[root@localhost ~]# chkconfig named on
c)   Kiểm tra hoạt động của host dns
[root@DNS conf]# host www.itdep.serverlinux.vn
www.itdep.serverlinux.vn is an alias for dns.serverlinux.vn.
dns.serverlinux.vn has address 192.168.1.17

[root@DNS conf]# host www.pcm.serverlinux.vn
www.pcm.serverlinux.vn is an alias for dns.serverlinux.vn.
dns.serverlinux.vn has address 192.168.1.17

[root@DNS conf]# host www.serverlinux.vn
www.serverlinux.vn is an alias for dns.serverlinux.vn.
dns.serverlinux.vn has address 192.168.1.17
d)  Tạo thư mục VirtualHost
[root@DNS conf]#mkdir /webhosting
[root@DNS conf]#mkdir /webhosting/pcm/webhosting/itdep
[root@DNS conf]vi /webhosting/pcm/index.html
<html>
<body>
      Day la trang web www.pcm.serverlinux.vn
</body>
</html>
[root@DNS conf]vi /webhosting/ itdep/index.html
<html>
<body>
Day la trang web www.itdep.serverlinux.vn
</body>
</html>
e)   Phần quyền cho các thư mục
-      [root@DNS conf]chmod 777 /webhosting/pcm/index.html/webhosting/itdep/index.html
f)    Cấu hình virtual host trong /etc/http/conf/httpd.conf
NameVirtualHost 192.168.1.17
#
…………………………………………………………..
#<VirtualHost *:80>
#ServerAdmin webmaster@dummy-host.example.com
#DocumentRoot /www/docs/dummy-host.example.com
#ServerName dummy-host.example.com
#ErrorLog logs/dummy-host.example.com-error_log
#CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost 192.168.1.17>
      DocumentRoot /var/www/html
      ServerName www.serverlinux.vn
</VirtualHost>

<VirtualHost 192.168.1.17>
      DocumentRoot /webhosting/pcm
      ServerName www.pcm.serverlinux.vn
</VirtualHost>

<VirtualHost 192.168.1.17>
      DocumentRoot /webhosting/itdep
      ServerName www.itdep.serverlinux.vn
</VirtualHost>
g)   Khởi động httpd
[root@DNS conf]# /etc/init.d/httpd restart
Stopping httpd:         [OK]
Starting httpd:         [OK]
[root@DNS conf]# chkconfig httpd on
h)  Truy cập vào web server http://serverlinux.vn
i)    Truy cập vào web server http://pcm.serverlinux.vn
j)    Truy cập vào web server http://itdep.serverlinux.vn

Bài đăng phổ biến