mkdir $HOME/temp cd $HOME/temp tar -zxvf /tmp/httpd-2.0.54.tar.gzYou should have the Apache source tree in the directory httpd-2.0.54.
cd httpd-2.0.54 ./configure --prefix=$HOME/httpd make make installAt this point, your Apache should be installed in $HOME/httpd. You should see the following directory tree in $HOME/httpd:
. ./include ./lib ./build ./bin ./modules ./conf ./htdocs ./error ./error/include ./icons ./icons/small ./logs ./cgi-bin ./man ./man/man1 ./man/man8 ./manual ./manual/developer ./manual/faq ./manual/howto ./manual/images ./manual/misc ./manual/mod ./manual/platform ./manual/programs ./manual/rewrite ./manual/ssl ./manual/style ./manual/style/lang ./manual/style/css ./manual/style/xsl ./manual/style/xsl/util ./manual/style/latex ./manual/vhosts
.... # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) # #Listen 188.8.131.52:80 Listen 8080 ....
# The same rules about trailing "/" apply to ScriptAlias directives as to # Alias. # ScriptAlias /cgi-bin/ "/home2/developer/httpd/cgi-bin/"This requires that you put any CGI scripts that you want to run in "/home2/developer/httpd/cgi-bin".
~/httpd/bin/apachectl startPoint your browser at "http://localhost:8080" and see if you can view the home page of your server.
cd $HOME/cgi-bin cp test-cgi test-cgi.cgi chmod ugo+x test-cgi.cgiNow, connect to "http://localhost:8080/cgi-bin/test-cgi.cgi?arg=foo" with your browser. You should see this:
CGI/1.0 test script report: argc is 0. argv is . SERVER_SOFTWARE = Apache/2.0.54 (Unix) SERVER_NAME = localhost GATEWAY_INTERFACE = CGI/1.1 SERVER_PROTOCOL = HTTP/1.1 SERVER_PORT = 8080 REQUEST_METHOD = GET HTTP_ACCEPT = text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 PATH_INFO = PATH_TRANSLATED = SCRIPT_NAME = /cgi-bin/test-cgi.cgi QUERY_STRING = arg=foo REMOTE_HOST = REMOTE_ADDR = 127.0.0.1 REMOTE_USER = AUTH_TYPE = CONTENT_TYPE = CONTENT_LENGTH =Now you are ready to run your own CGI scripts by putting them in $HOME/httpd/cgi-bin.
# # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/home2/developer/httpd/htdocs"
The similarly named variable ServerRoot should not be confused with DocumentRoot. ServerRooot is the name of the UNIX directory where the configuration files reside. If you use the above configuration, ServerRoot is $HOME/httpd (where the directory "conf" with the file "httpd.conf" lives).
Document Root is the top directory in which the HTML files reside. This is a UNIX directory! In general, the term "directory" refers to the UNIX directory, while the term "location" is used to refer to a directory relative to the server root. Thus, if the browser requests "http://server_host/foo/bar.html", Apache configured as above, will serve the file /home2/developer/httpd/htdocs/foo/bar.html.