Posts tagged: apache

OS X and Apache Web server

How to configure and run the Apache Web server included on OS X

Apache Tomcat 6.0 Logging

ApacheĀ  Tomcat 6.0 logging

There are two easy places to find configuration information about Tomcat logging.

  • Apache Tomcat Home Documentation – http://tomcat.apache.org/tomcat-6.0-doc/logging.html
  • In any Tomcat instance – http://localhost:8080/docs/logging.html

A summary for the faint of heart.

Apache Tomcat 6.0 changes the logging model from Apache Tomcat 5.5. All comments from here on that refer to Apache Tomcat are referring to Apache Tomcat 6.0.

  • Java provides java.util.logging as a default logging package, configured by default in the JVM at $JAVA_HOME/lib/logging.properties
  • Apache Tomcat replaces the default Java java.util.logging implementation with org.apache.juli to add features, improve logging isolation and per-webapp control
  • The Apache Tomcat core configures logs based on settings in $CATALINA_HOME/conf/logging.properties.
  • Individual webapps configure logging based on settings in WEB-INF/classes/logging.properties.

Log4j can be used instead of the org.apache.juli package for Tomcat’s internal logging and/or individual webapp logging.

  • Log4j can be used to manage Tomcat’s internal logging instance of the org.apache.juli package. Refer to the Apache Tomcat logging documentation for further information.
  • To use log4j within a specific webapp, two simple steps are required
    • Copy a log4j-x.y.z.jar to WEB-INF/lib
    • Create a log4j.properties file in WEB-INF/classes

Apache 2 + FastCGI

Some build things ….

Apache2 needs the following flags set on the build

[To be filled in]

So does FastCGI itself.

Some configuration things …

Script Directory

Start at the root of the directory tree (“/”) that contains any directory using an ALIAS or SCRIPTALIAS directive. Every directory in the tree must be readable to the Apache2 server, usually running as “www:www”. This means read and execute permissions ( ‘o+rx’) for the world for every directory in the tree.

ALIAS vs SCRIPTALIAS

Appears to matter for CGI, but oddly enough, not for FCGI. Go figure.

IPC Directory

The IPC directory set by the required directive:

FastCgiIpcDir /var/run/fcgi

must have read and write permission to the Apache2 user, “www:www”. The easiest thing is to make ‘www:www” the user, and specify “u+rwx”.

File extensions

You need to make sure that the extension specified for the FCGI handler – normally .fcgi – matches that used for the files themselves.

Example

# /var/run/fcgi needs to have write permission for user www:www (see main file)
FastCgiIpcDir /var/run/fcgi
LoadModule fastcgi_module modules/mod_fastcgi.so
#AddHandler fastcgi-script .fcgi

#ScriptAlias /test/ “/home/jay/test_apache2/”
Alias /test/ “/home/jay/test_apache2/”

<Directory “/home/jay/test_apache2/”>
Options All
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
</Directory>

Apache 2 – Configuration and build

Configuration options that seem to make Apache2 and Ruby on Rails happy

./configure \
–enable-rewrite=yes \
–enable-dav=yes \
–enable-suexec \
–with-suexec-docroot=/usr/local/apache2/htdocs \
$@

Apache SSL Rewrite Rule

An Apache rewrite rule to force SSL on every request. Place in .htaccess in any directory where you want this to happen.

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

WordPress Themes