WebServer » History » Version 3

« Previous - Version 3/6 (diff) - Next » - Current version
Anonymous, 03/28/2008 02:45 PM
Changed Apache configuration file for logging and test release


= Web Server Configuration =
Make the following changes to the Apache configuration file (''/etc/httpd/conf/httpd.conf''): {{{ #
  1. Listen: Allows you to bind Apache to specific IP addresses and/or
  2. ports, in addition to the default. See also the <VirtualHost>
  3. directive. #
  4. Change this to Listen on specific IP addresses as shown below to
  5. prevent Apache from glomming onto all bound IP addresses (0.0.0.0) #
    #Port 80 : Stable production version (release)
    #Port 8080: Stable test version (pre-release)
    Listen 80
    Listen 8080

User procksi
Group procksi
ServerAdmin
ServerName procksi.cs.nott.ac.uk
DocumentRoot /home/procksi/latest/html
<Directory /home/procksi/latest/html">
AllowOverride AuthConfig
</Directory>
LogFormat "%t h %l %u \"%r\" %>s %b \"{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%t %h %l %u \"%r\" %>s %b" common
LogFormat "%t %{Referer}i -> %U" referer
LogFormat "%t %{User-agent}i" agent

#Exclude Logging of Ganglia Requests
SetEnvIf Request_URI "ganglia" ganglia

#
  1. ErrorLog: The location of the error log file.
  2. If you do not specify an ErrorLog directive within a <VirtualHost>
  3. container, error messages relating to that virtual host will be
  4. logged here. If you do define an error logfile for a <VirtualHost>
  5. container, that host's errors will be logged there and not here. #
    ErrorLog /home/procksi/logs/latest_error.log
#
  1. The location and format of the access logfile (Common Logfile Format).
  2. If you do not define any access logfiles within a <VirtualHost>
  3. container, they will be logged here. Contrariwise, if you do
  4. define per-<VirtualHost> access logfiles, transactions will be
  5. logged therein and not in this file. #

CustomLog /home/procksi/logs/latest_access.log common env=!ganglia

#
  1. If you would like to have agent and referer logfiles, uncomment the
  2. following directives. #

CustomLog /home/procksi/logs/latest_referer.log referer env=!ganglia
CustomLog /home/procksi/logs/latest_agent.log agent env=!ganglia

#
  1. For a single logfile with access, agent, and referer information
  2. (Combined Logfile Format), use the following directive: #
    #CustomLog logs/access_log combined env=!ganglia

ScriptAlias /cgi-bin/ /home/procksi/latest/cgi-bin/

<Directory "/home/procksi/latest/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

Alias /data/ /home/procksi/latest/data/
Alias /images/ /home/procksi/latest/images/
Alias /styles/ /home/procksi/latest/styles/
Alias /applets/ /home/procksi/latest/applets/
Alias /scripts/ /home/procksi/latest/scripts/
Alias /ganglia/ /usr/local/ganglia/html/

#Redirection
Redirect /trac https://psiren.cs.nott.ac.uk/projects/procksi/

AddLanguage de .de
AddLanguage en .en
AddLanguage es .es
AddLanguage fr .fr
LanguagePriority en es de fr

Alias /errordocs/ "/home/procksi/errordocs"
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
<Directory /home/procksi/errordocs>
AllowOverride none
Options MultiViews IncludesNoExec FollowSymLinks
AddType text/html .shtml
<FilesMatch "\.shtml[.$]">
SetOutputFilter INCLUDES
</FilesMatch>
</Directory>

ErrorDocument 400 /errordocs/400_BAD_REQUEST
ErrorDocument 401 /errordocs/401_UNAUTHORIZED
ErrorDocument 403 /errordocs/403_FORBIDDEN
ErrorDocument 404 /errordocs/404_NOT_FOUND
ErrorDocument 405 /errordocs/405_METHOD_NOT_ALLOWED
ErrorDocument 406 /errordocs/406_NOT_ACCEPTABLE
ErrorDocument 408 /errordocs/408_REQUEST_TIMEOUT
ErrorDocument 410 /errordocs/410_GONE
ErrorDocument 411 /errordocs/411_LENGTH_REQUIRED
ErrorDocument 412 /errordocs/412_PRECONDITION_FAILED
ErrorDocument 413 /errordocs/413_REQUEST_ENTITY_TOO_LARGE
ErrorDocument 414 /errordocs/414_REQUEST_URI_TOO_LARGE
ErrorDocument 415 /errordocs/415_UNSUPPORTED_MEDIA_TYPE
ErrorDocument 500 /errordocs/500_INTERNAL_SERVER_ERROR
ErrorDocument 501 /errordocs/501_NOT_IMPLEMENTED
ErrorDocument 502 /errordocs/502_BAD_GATEWAY
ErrorDocument 503 /errordocs/503_SERVICE_UNAVAILABLE
ErrorDocument 506 /errordocs/506_VARIANT_ALSO_VARIES
&lt;/IfModule&gt;
&lt;/IfModule&gt;

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from .cs.nott.ac.uk
</Location>

<Location /server-info>
SetHandler server-info
Order deny,allow
Deny from all
Allow from .cs.nott.ac.uk
</Location>

#
  1. Use name-based virtual hosting. #
    NameVirtualHost *:8080

<VirtualHost *:8080>
ServerName procksi.cs.nott.ac.uk
ServerAdmin
DocumentRoot /home/procksi/test/html
ServerName procksi.cs.nott.ac.uk:8080
ErrorLog /home/procksi/logs/test_error.log
CustomLog /home/procksi/logs/test_access.log common env=!dontlog
LogLevel debug
ScriptAlias /cgi-bin/ /home/procksi/test/cgi-bin/
Alias /data/ /home/procksi/test/data/
Alias /images/ /home/procksi/test/images/
Alias /styles/ /home/procksi/test/styles/
Alias /applets/ /home/procksi/test/applets/
Alias /scripts/ /home/procksi/test/scripts/
</VirtualHost>
}}}

  • Add search path for programs. Modify ''/etc/init.d/httpd'' to read: {{{
    RETVAL=0
    PATH="$PATH:/usr/local/bin"
    }}}
  • Make the apache daemon start at bootup. Enter at the command line of the master node: {{{
    /sbin/chkconfig --add httpd
    /sbin/chkconfig httpd on
    }}}
  • Start the apache daemon. Enter at the command line of the master node: {{{
    /sbin/service httpd restart
    }}}