9/21/2010

Config Apache

Here is an example to configure Apache. I set it 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


ServerTokens
Prod
// line 44: change


KeepAlive
On
// line 74: change to ON


ServerAdmin
root@server-linux.info
// line 250: Admin's address


ServerName
www.server-linux.info:80
// line 264: server's name


Options FollowSymLinks
ExecCGI
// line 319: change (disable Indexes)


AllowOverride
All
// line 326: change


#
UserDir disable
// line 354: make it comment


UserDir public_html
// line 361: make valid


// line 369 - 380 : remove # and make valid


AllowOverride
All
// change

Options
ExecCGI
// CGI enabled


Order allow,deny
Allow from all


Order deny,allow
Deny from all



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

DirectoryIndex index.html
index.cgi index.php


ServerSignature
Off
// line 523: change
#
AddDefaultCharset UTF-8
// line 746: make it comment
// line 777: 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

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
Test Page

Make CGI 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.cgi
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print <<"EOM";
CGI Test Page
[root@www ~]#
chmod 705 index.cgi

Make PHP 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.php
print Date("Y/m/d");
?>

No comments:

Post a Comment