Categories: Ports
Author: Jürgen Daubert
This page lists some hints/informations for the CRUX apache ports. Apache is highly configurable and also a very complicated piece of software. Each user should configure and build his "own" server, that suits best for the specific needs.
A comprehensive paper howto configure apache and many of it's modules can be found here.
If you need a fast server for your home-network or even small puplic web pages, I recommend one of other http server available as CRUX ports:
All of them need a minimum of configuration and system resources, and don't cluster your harddisk with a lot of files. And best of all, they are much faster than apache for static content.
All ports for Apache 2.0.x are part of the CRUX ports collection, the ports for Apache 1.3.x are no longer maintained by me, but still available for download.
Mostly modular, basic server. SSL and WebDAV support included.
To activate WebDAV support add the following line within the 'Main server configuration' section of your /etc/apache/httpd.conf:
DAVLockDB /tmp/DAVLock
Now you are ready to put a 'DAV On' statement within a <Directory> or <Location> directive. For example:
<Directory "/home/www/public/"> DAV on AuthType Basic AuthName "Users only" AuthUserFile /etc/apache/passwords Require valid-user </Directory>
gives all users, registered in /etc/apache/passwords, read/write access to your public directory. You can restrict this more with the usual apache directives. This directory must be owned by the effective user/group, e.g. nobody/nobody, apache is running to allow write access.
The access to a WebDAV enabled apache is much like ftp. A CRUX port for the commandline WebDAV client cadaver is available. The sitecopy utility works also, besides ftp, with a WebDAV enabled http servers.
Mod_ssl is already included in apache 2.0.0 and above. If you have installed a precompiled apache package you should recreate the SSL certificate.
Create a selfsigned SSL certificate:
# openssl req -new > my.csr # openssl rsa -in privkey.pem -out my.key # openssl x509 -in my.csr -out my.cert -req -signkey my.key -days 999 # cp my.key /etc/apache/ssl.key/server.key # cp my.cert /etc/apache/ssl.crt/server.crt
If you don't need SSL support at all, edit the /etc/rc.d/apache start script in order to deactivate SSL.
# sed -i -e 's|^START=.*|START=start|g' /etc/rc.d/apache
PHP support for apache. Build as external DSO module. After installation you have to edit the configuration file /etc/apache/httpd.conf of apache to enable the php stuff.
Locate the lines where modules will be loaded, and append the following lines to the appropriate places:
LoadModule php5_module lib/apache/libphp5.so
Add the php mime type:
AddType application/x-httpd-php .php
Finally extend the index list. Change the DirectoryIndex line to:
DirectoryIndex index.html index.html.var index.php
To verify the PHP installation create a document test.php with the content
<?PHP phpinfo();?>
and load it with your browser.
mod_ruby embeds the Ruby interpreter into the Apache web server, allowing Ruby CGI scripts to be executed natively. These scripts will start up much faster than without mod_ruby. Together with eruby it's very easy to generate dynamic html pages.
A very good guide how to configure apache for mod_ruby can be found here. With the following simple configuration all *.rhtml files will be parsed by eruby:
LoadModule ruby_module lib/apache/mod_ruby.so <IfModule mod_ruby.c> RubyRequire apache/eruby-run <Files *.rhtml> SetHandler ruby-object RubyHandler Apache::ERubyRun.instance </Files> </IfModule>
I'm not a perl fan, but to be honest, perl scripts running persitently with mod_perl are much faster than comparable php scripts. A typical apache configuration, running the usemod wiki with mod_perl, could look like the following:
LoadModule perl_module lib/apache/mod_perl.so Alias /wiki /var/www/cgi-bin/wiki.pl <Location /wiki> SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders Options ExecCGI </Location>