Apache Notes

FROM WIKIPEDIA: The Apache HTTP Server, commonly referred to simply as Apache, is a web server notable for playing a key role in the initial growth of the World Wide Web. Apache was the first viable alternative to the Netscape Communications Corporation web server (currently known as Sun Java System Web Server), and has since evolved to rival other Unix-based web servers in terms of functionality and performance. Since April 1996 Apache has been the most popular HTTP server on the World Wide Web.

The project's name was chosen for two reasons: out of respect for the Native American Indian tribe of Apache (Indé), well-known for their endurance and their skills in warfare, and due to the project's roots as a set of patches to the codebase of NCSA HTTPd 1.3 - making it "a patchy" server.

Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation. The application is available for a wide variety of operating systems including Microsoft Windows, Novell NetWare and Unix-like operating systems such as Linux and Mac OS X. Released under the Apache License, Apache is free and open source software.



Note: form action has to use cgi-bin NOT CGI-Executables. (Mac OS X constraint)

Restart Apache Command- sudo apachectl graceful

Other apachectl commands:

apachectl (start | stop | restart | fullstatus* | status* | graceful | configtest | help) *will only work with mod_status loaded


httpd.conf
To get PHP to work (uncomment this line) #LoadModule php4_module libexec/httpd/libphp4.so
Setting groups User www
Group www
Change Apache to find your Directory <Directory "/Library/WebServer/Documents">
change to <Directory "/Users/joe/Sites/"> (example)
Change Apache to find index.html <DocumentRoot "/Library/WebServer/Documents">
change to <DocumentRoot "/Users/joe/Sites/"> (example)
To include Sever Sides Includes (add +Includes) Options Indexes FollowSymLinks MultiViews +Includes
To use server-parsed HTML files (uncomment this line) #AddType text/html .shtml
#AddHandler server-parsed .shtml
To get .html files to parse .php (<?php echo "parse this."; ?>) RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html
To add Server Side Incules as Main Home Page (index.html) <IfModule mod_dir.c>
DirectoryIndex index.html index.shtml
</IfModule>
Configure Directory <IfModule mod_userdir.c>
UserDir Sites
</IfModule>

<IfModule mod_userdir.c>
UserDir public_html
</IfModule>

These lines below were added to my httpd.conf file.
Include /private/etc/httpd/users/*.conf <IfModule mod_php4.c>
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php

The Apache documentation below outlines the eight available warning levels and provides an example of what would be logged at that level.
Emerg Emergencies - system is unusable -- e.g. "Child cannot open lock file. Exiting"
Alert Action must be taken immediately. -- e.g. "getpwuid: couldn't determine user name from uid"
Crit Critical Conditions. -- e.g. "socket: Failed to get a socket, exiting child"|
Error Error conditions -- e.g. "Premature end of script headers"
Warn Warning conditions -- e.g. "child process 1234 did not exit, sending another SIGHUP"
Notice Normal but significant condition -- e.g. "httpd: caught SIGBUS, attempting to dump core in ..."
Info Informational -- e.g. "Server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers)..."
Debug Debug-level messages -- e.g. "Opening config file ..."

Methods
Request methods
HTTP Defines eight methods (sometimes referred to as "verbs") indicating the desired action to be performed on the identified resource.
HEAD Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.
GET Requests a representation of the specified resource. By far the most common method used on the Web today. Should not be used for operations that cause side-effects (using it for actions in web applications is a common misuse).
POST Submits data to be processed (e.g. from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both.
PUT Uploads a representation of the specified resource.
DELETE Deletes the specified resource.
TRACE Echoes back the received request, so that a client can see what intermediate servers are adding or changing in the request.
OPTIONS Returns the HTTP methods that the server supports. This can be used to check the functionality of a web server.
CONNECT Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.[1]
HTTP Servers are supposed to implement at least the GET and HEAD methods and, whenever possible, also the OPTIONS method.

Directive
Description
PidFile
The file that records the process of the Apache service (such as logs/httpd.pid)
ScoreBoardFile
The file that stores internal process information (such as logs/ logs/apache_runtime_status)
ErrorLog
The file that records service errors (logs/error_log)
CustomLog
Refers to the series of files that record visitor information. Use a separate entry for each type of log. (logs/access_log common, logs/referer_log referrer, logs/agent_log agent, or logs/access_log combined). There are many options for the CustomLog directive. (Please refer to the Apache documentation for complete details.)
Listen
The IP Address and port to which the service will be bound. Use instead of the deprecated Port directive.
ServerName
The DNS hostname of your server and port. An IP address and port may also be used.
DocumentRoot
The absolute path to the directory that contains your websites
ServerRoot
The absolute path to the directory that contains all subfolders (conf, logs, htdocs, and so on)
<Directory>…</Directory>
The default Directory directive that contains the global directives for the specified service