Apache HTTP server
Apache version
Tested with Apache 1.3.33.
Overview
Apache is the most commonly-used
HTTP server. Here we install it with some modules that we'll need for other things in
ServerConfigStandard.
We recommend Apache 1.3, because not all modules are ready for Apache 2.0.
Apache runs as user
apache, group
apache.
Virtual hosts are configured in
/usr/local/apache/conf/virtual_hosts. Each virtual host has a file in
/usr/local/apache/conf/vhost.
HTML documents are in
/var/www/domainname/htdocs.
Icons are in subdirectories of
/var/www/icons.
Installation
Install prerequisites:
sudo apt-get install libperl-dev libwww-perl libgdbm-dev libc6-dev
Download the latest release of
Apache 1.3.
Download
FastCGI.
Download
mod_perl.
Install
/usr/local/configure-wrappers/configure-apache-mod-perl (make it world-executable).
Make an Apache user, and set up directories:
sudo adduser --system --home /var/www --group apache
sudo mkdir -p /usr/local/apache/conf/vhost
sudo mkdir -p /var/www/icons
Compile and install Apache:
tar zxf apache_1.3.x.tar.gz
tar zxf mod_perl-1.x.tar.gz
tar zxf mod_fastcgi-x.y.z.tar.gz
mv mod_fastcgi-x.y.z apache_1.3.x/src/modules/fastcgi
cd mod_perl-1.x
/usr/local/configure-wrappers/configure-apache-mod-perl
make
make test
sudo make install
sudo cp -r /usr/local/apache/icons/* /var/www/icons/
Install these files:
Make init script symlinks:
sudo update-rc.d apache defaults 25
Create a file,
/usr/local/apache/conf/virtual_hosts (change the IP address to server's IP address):
# Use name-based virtual hosting.
NameVirtualHost 10.0.0.243
# each vhost is kept in each own separate file in the 'vhost' directory.
Start Apache:
sudo /etc/init.d/apache start
Adding virtual hosts
Here we'll add a virtual host for
www.example.org.
Make directories for the virtual host's HTML files and logs:
sudo mkdir -p /var/www/www.example.org/htdocs
sudo mkdir -p /var/www/www.example.org/logs
Create a file,
/usr/local/apache/conf/vhost/www.example.org, containing the Apache configuration for the virtual host. It should look like this (substitute your IP address and domain name):
<VirtualHost 10.0.0.243:80>
ServerAdmin webmaster@example.org
DocumentRoot /var/www/www.example.org/htdocs
ServerName www.example.org
ErrorLog /var/www/www.example.org/logs/error.log
CustomLog /var/www/www.example.org/logs/access.log common
# Prevent 'Cross-Site Tracing' attacks
# (http://www.apacheweek.com/issues/03-01-24#news)
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</IfModule>
</VirtualHost>
Add two lines like this to
/usr/local/apache/conf/virtual_hosts, to include the virtual host's config file:
# www.example.org
include conf/vhost/www.example.org
Restart Apache:
sudo /etc/init.d/apache restart
Adding webdav support
Download latest
mod_dav source.
tar zxf mod_dav-1.0.3-1.3.6.tar.gz
cd mod_perl-dav.x
/usr/local/configure-wrappers/configure-mod-dav
make
sudo make install
Check apache config syntax, and make sure there are no error from mod_dav loading:
sudo /usr/local/apache/bin/apachectl configtest
sudo /usr/local/apache/bin/apachectl graceful
You should see in apache error log:
Apache/1.3.33 (Unix) DAV/1.0.3 mod_fastcgi/2.4.2 mod_perl/1.29 configured -- resuming normal operations
webdav docs & bugs
Upgrading
Compile and install Apache and FastCGI using mod_perl as described above, then install
/usr/local/apache/bin/apachectl (and make it executable).
to top