Bài 13:Cấu hình Web server(phần 1-Apache)

1.Cài đặt httpd.

[1]Cài đặt httpd

[root@www ~]#yum -y install httpd

# remove welcome page

[root@www ~]#rm -f /etc/httpd/conf.d/welcome.conf

# remove default error page

[root@www ~]#rm -f /var/www/error/noindex.html

<

[2] Cấu hình httpd.

[root@www ~]#vi /etc/httpd/conf/httpd.conf

# line 44: change

ServerTokens  Prod

# line 76: change to ON

KeepAlive     On

# line 262: Admin’s address

ServerAdmin   root@server.world

# line 276: change to your server’s name

ServerName   www.server.world:80

# line 338: change

AllowOverride  All

# line 402: add file name that it can access only with directory’s name

DirectoryIndex index.html   index.htm

# line 536: change

ServerSignature      Off

# line 759: make it comment
#AddDefaultCharset UTF-8

[root@www ~]#/etc/rc.d/init.d/httpd start

Starting httpd:[ OK ]

[root@www ~]#chkconfig httpd on

[3] Tạo trang HTML có nội dung như bên dưới. sau đó truy cập tới trang này

[root@www ~]#vi /var/www/html/index.html

<html>
<body>
<div style="font-weight: bold;">
Test Page
</div>
</body>
</html>