10/07/2010

Install httpd

This is an example to build Web Server. Install Apache for it. In addition to do it, And it's also neccessary to configure router so that TCP and UDP packets to 80 and 443 can pass through.
[1] Install httpd
[root@www ~]# yum -y install httpd
# remove test page
[root@www ~]# rm -f /etc/httpd/conf.d/welcome.conf
# remove test page
[root@www ~]# rm -f /var/www/error/noindex.html
# create a link for Perl
[root@www ~]# ln -s /usr/bin/perl /usr/local/bin/perl
[2] Configure httpd.
[root@www ~]# vi /etc/httpd/conf/httpd.conf

# line 44: change
ServerTokens Prod

# line 74: change to ON
KeepAlive On

# line 251: Admin's address
ServerAdmin root@server.world

# line 265: server's name
ServerName www.server.world:80

# line 320: change (disable Indexes)
Options FollowSymLinks ExecCGI

# line 327: change
AllowOverride All

# line 391: add file name that it can access only with directory's name
DirectoryIndex index.html index.cgi index.php

# line 524: change
ServerSignature Off

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

# line 778: uncomment and add file-type that apache looks them CGI
AddHandler cgi-script .cgi .pl

[root@www ~]# /etc/rc.d/init.d/httpd start
Starting httpd: [ OK ]
[root@www ~]# chkconfig httpd on
[3] Make HTML test page and access to it with web browser. It's OK if following page is shown.
[root@www ~]# vi /var/www/html/index.html
Test Page

[4] Make CGI test page and access to it with web browser. It's OK if following page is shown.
[root@www ~]# vi /var/www/html/index.cgi

CGI Test Page

[root@www ~]# chmod 705 /var/www/html/index.cgi

No comments:

Post a Comment