Category Archives: Debian

Virtual Web Servers: Apache2 on Debian

This is a short How-To about setting up multiple domain names, or sub-domains on Debian Squeeze using Apache 2.2
The following is the actual configurations of a working server with 2 subdomains on it.
It throws an error that does not stop it from working.


#=======snippet from apache2.conf

# Include generic snippets of statements
Include conf.d/

#=======Contents of conf.d directory=======================
wolf@SERVER-01:/etc/apache2/conf.d$ ls
charset localized-error-pages other-vhosts-access-log security virtual.conf

#=======Configuration of virtual.conf=======================

wolf@SERVER-01:/etc/apache2/conf.d$ cat virtual.conf
# running virtual hosts
#
NameVirtualHost *

#======Contents of the sites-available directory============

wolf@SERVER-01:/etc/apache2/sites-available$ ls
default default-ssl legacy

#======Configuration for dev.example.net====================

wolf@SERVER-01:/etc/apache2/sites-available$ cat default

ServerAdmin wolf.halton@ lyrasis.org
ServerName dev.example.net
ServerAlias www.dev.example.net

DocumentRoot /var/www/http/

Options FollowSymLinks
AllowOverride All


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

#========Configuration for legacy.example.net======================
wolf@SERVER-01:/etc/apache2/sites-available$ cat legacy
# This is the settings file for the legacy.example.net site


ServerAdmin wolf.halton@ lyrasis.org
ServerName www.legacy.example.net
ServerAlias legacy.example.net

# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /var/www/legacy/htdocs/

# CGI Directory
ScriptAlias /cgi-bin/ /var/www/legacy/cgi-bin/

Options +ExecCGI

# Logfiles
ErrorLog /var/www/legacy/logs/error.log
CustomLog /var/www/legacy/logs/access.log combined

Nagios Plugins 1.4.16 Installation Notes

Even simple things are hard when you have never done them.
There is a pretty good How-to at http://nagios.sourceforge.net/docs/3_0/quickstart-ubuntu.html for installing Nagios, and plugins, generally. I use Debian, so there may be a few minor differences between an Ubuntu install and my installation on Debian. Mostly I wanted to add a few notes about issues I run into when adding a remote server to the nagios family. You have to do a few things that are not in the instructions.
Before you begin, make sure you have a C-language compiler installed as well as ‘make.’
# aptitude install gcc make
also, your ssl_version in Nagios-Plugins will fail if you do not have libssl-dev installed.
# aptitude install libssl-dev
Your make will continue to fail in an unhelpful manner if you do not now re-run your configure command.
[nagios-plugins-src-dir]$ ./configure --with-nagios-user=nagios --with-nagios-group=nagios
Then run make and it will run properly.
[nagios-plugins-src-dir]$ make
Run make install as root.
[nagios-plugins-src-dir]# make install
Change ownership of the nagios-installation directory to nagios.
# chown -R nagios:nagios /usr/local/nagios
The plugins live in the /usr/local/nagios/libexec folder.

Make sure your nagios@nagiosserver can shell into the nagios@remote-server without a pass-phrase or it will not be able to run "command_over_ssl." I am not yet running the NRE as I understand ssl well enough to use it.

Thanks to Dave Bonnell for the libssl-dev suggestion http://sourceforge.net/mailarchive/message.php?msg_id=29576799

Make sure you ssh into each remote server as nagios@nagiosserver to get past the "Add this server to known hosts" dialog, otherwise nagios will not be able to send test requests automatically.