Apache configuration in Pustefix 0.13.x
Prerequisites: Make sure your machine is configured as follows
- Your host ip must not be 127.0.0.1. (TODO: why, what happens if not.) Verify this by running ping HOSTNAME
- Your dns domain is configured properly: hostname -d should yield your host's domain. If not set up propertly, you tomcat configuration (server.xml) contains invalid host names.
- Pustefix uses virtual hosts, i.e. a lookup to FOO.HOSTNAME.DOMAIN should resolves to HOSTNAME.DOMAIN no matter what FOO is. Test this by running ping FOO.HORSTNAME To configure this you can add an * entry to your DNS configuration. Alternatively, you can add individual entries for every project (e.g. sample1.HOSTNAME.DOMAIN) to your /etc/hosts.
- The pustefix directory has to be world-readable, otherwise, apache cannot serve static resources like pictures or style-sheets. Usually, this is done by running chmod a+rx.
TODO: doesn't belong to getting started - it's an advanced subject.
To run pustefix applications in productions environments, you might want to embed tomcat in an apache web server. This section describes how to do this on Linux machines.
- Install Apache 2: Rpm packages are supplied for most Linux distributions.
- Install mod_jk: mod_jk is the apache connection module for tomcat. Rpm packages can be found at jpackage.org. Gentoo: emerge mod_jk. Documentation can be found here.
- Make sure that mod_ssl is installed: look for a file /usr/lib/httpd/modules/mod_rewrite.so. Without mod_ssl, apache will complain that about the httpd.conf include below. Most distributions include mod_ssl rpm files.
- Make sure the rewrite module is installed: look for a file /usr/lib/httpd/modules/mod_rewrite.so
- Load mod_jk: Add the following line to your httpd.conf, right before the rewrite module configuration: !LoadModule jk_module modules/mod_jk.so Caution: There have been problems with the order of inclusion of mod_rewrite and mod_jk. It seems that mod_jk needs to be loaded BEFORE mod_rewrite. Other problems that have been experienced are related to a changed regexp syntax between different versions of mod_rewrite. You may have to customize the relevant regexps in the file core/build/create_apacheconf.xsl.
- Configure pustefix: Append the following lines to your httpd.conf. Substitute the capitalized fragments to reflect your configuration.
# at the end NameVirtualHost HOSTNAME.DOMAIN:80 NameVirtualHost HOSTNAME.DOMAIN:443 # config for mod_jk Include /YOUR_ENVIRONMENT/projects/servletconf/tomcat/jk.conf # virtual hosts for tomcat: Include /YOUR_ENVIRONMENT/projects/servletconf/tomcat/apache.conf
Modern apache installations often have an httpd.conf.d directory where to put links to config files that should be included automatically. In this case you can link the two files there instead of including them via your http.conf.
Finally restart apache and you're ready to go.
