Fedora 10
Sponsored Link

Configure httpd2008/11/30

[1] Here is an example to configure Apache. This example shows that users can open to the public their Web site and can execute CGI in any directories. ( SSI is disabled because it's not used so often )
[root@www ~]#
vi /etc/httpd/conf/httpd.conf


# line 44: change

ServerTokens
Prod


# line 74: change to ON

KeepAlive
On


# line 250: webmaster's address

ServerAdmin
root@srv.world


# line 264: server's name

ServerName
www.srv.world:80


# line 319: change (disable Indexes)

Options FollowSymLinks
ExecCGI


# line 326: change

AllowOverride
All


# line 354: make it comment

#
UserDir disable

# line 361: uncomment

UserDir public_html

# line 369 - 380 : uncomment

<Directory /home/*/public_html>
    AllowOverride
All
# change

    Options
ExecCGI
# enable CGI

    <Limit GET POST OPTIONS>
         Order allow,deny
         Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
         Order deny,allow
         Deny from all
    </LimitExcept>
</Directory>

# line 390: add file name that it can access only with directory's name

DirectoryIndex index.html
index.cgi index.php


# line 523: change

ServerSignature
Off


# line 746: make it comment

#
AddDefaultCharset UTF-8

# line 783: make valid 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

[2] Make HTML test page and Make sure apache is working. It's OK if following page is shown.
[root@www ~]#
cd /var/www/html

[root@www html]#
vi index.html


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


[root@www html]#
cd ../

[root@www www]#
chown -R fedora. html

 
[3] Make CGI test page and Make sure apache is working. It's OK if following page is shown.
[root@www www]#
cd html

[root@www html]#
vi index.cgi


#!/usr/local/bin/perl

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


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

[root@www html]#
chown fedora. index.cgi

 
[4] Make PHP test page and Make sure apache is working. It's OK if following page is shown.
[root@www html]#
vi index.php


<html>
<body>
<div style="width:100%;font-size:40px;font-weight:bold;text-align:center">
<?php
print Date("Y/m/d");

?>
</div>
</body>
</html>


[root@www html]#
chown fedora. index.php

 
Matched Content