Fedora 16
Sponsored Link

Install/Configure httpd2011/11/12

 
This is an example to configure Web Server. Install httpd for it. In addition to do it, 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 43: change

ServerTokens
Prod
# line 75: change to ON

KeepAlive
On
# line 261: Admin's address

ServerAdmin
root@srv.world
# line 275: change to your server's name

ServerName
www.srv.world:80
# line 330: change (enable CGI and disable Indexes)

Options FollowSymLinks
ExecCGI
# line 337: change

AllowOverride
All
# line 401: add file name that it can access only with directory's name

DirectoryIndex index.html
index.cgi index.php
# line 535: change

ServerSignature
Off
# line 758: make it comment

#
AddDefaultCharset UTF-8
# line 795: uncomment and add file-type that apache looks them CGI

AddHandler cgi-script .cgi
.pl
[root@www ~]#
systemctl start httpd.service

[root@www ~]#
systemctl enable httpd.service

[3] Create a 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
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page
</div>
</body>
</html>
[4] Create a 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
#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
print "<div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\">\n";
print "CGI Test Page";
print "\n</div>\n";
print "</body>\n</html>\n";

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

Matched Content