email for multiple virtual domains with exim4 dovecot

Posted by Steve on Mon 16 May 2005 at 15:46
Many mail servers need to handle mail for multiple virtual domains. This can easily be achieved with Sendmail, postfix, or qmail. Here we’ll cover how it’s done with exim4 – the default mailserver for Sarge.
This is an update to a previous article here: Handling mail for multiple domains with exim3.
The upgrade from Exim3, the default mailserver for Woody, to Exim4, the default mail server for Sarge is a fairly painless process.
We covered the upgrade process in upgrading from Woody to Sarge: Part 3 – Exim4, but just to recap:
There are two main exim4 packages to choose from:
exim4-daemon-light – A basic and functional server.
exim4-daemon-heavy – A more complex server with advanced features.
When using the exim4 package you have two choices:
Use a single monolithic configuration file (As exim3 used).
Using a split configuration system with a lot of small files.

Installing Exim4 – if you need to
Because I’m going to want to scan incoming mail for viruses as they are delivered, rather than filter them out myself once I’ve accepted them I will install the heavy version of the server:
root@lappy:~# apt-get install exim4-daemon-heavy
Reading Package Lists… Done
Building Dependency Tree… Done
The following extra packages will be installed:
exim4-base exim4-config
Suggested packages:
eximon4 exim4-doc-html exim4-doc-info
The following NEW packages will be installed:
exim4-base exim4-config exim4-daemon-heavy
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1033kB/1450kB of archives.
After unpacking 1155kB of additional disk space will be used.
Do you want to continue? [Y/n]

Once this has downloaded you will start the debconf configuration process.
The first question asked is ‘Do you wish to use a single monolithic configuration file, or split files?’ Here I chose the split file approach, to make future upgrades more simple.
Once that was done you’re left to choose the type of configuration you wish to use – I chose “an internet site”, because I want to send and receive mail directly. This choice does affect the subsequent questions you’ll have.
Choosing the mail name should be obvious, as should choosing which addresses you wish the server to listen upon.
Once that’s done the basic setup is complete – but we’ve still got to handle the virtual domain setup.

Generate Local Server-side Certificate
Run the command:

(adding the ‘–force’ option if you have already done this once. This is a debian specific operation, and there is no analogous step needed on other systems
Then execute:
openssl req -new -key /etc/exim4/exim.key -out /etc/exim4/exim.csr

Here comes the command to create a Dovecot certificate:
openssl req -new -x509 -days 3650 -nodes -out /etc/ssl/certs/dovecot.pem -keyout /etc/ssl/private/dovecot.pem
sudo vi /etc/dovecot/conf.d/10-ssl.conf

mettere solo questo
ssl_cert =

Apache Settings Virtualhost

apt-get install apache2
chown -R www-data:www-data /var/www
mkdir /var/www/
mkdir /var/www/
mkdir /var/log/

Now create the config file in apache2 dir

vi /etc/apache2/site-available/

<VirtualHost *:80>  # mine setting is <VirtualHost *:8080>


# Indexes + Directory Root.
DirectoryIndex index.html index.htm index.php
DocumentRoot /var/www/

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

Options +ExecCGI

# Logfiles
ErrorLog /var/log/
CustomLog /var/log/ combined

Create link to enabled site using this useful Debian command
remove default settings

a2dissite default

add your new site setting


xdebug netbeans

sudo apt-get install php-dev php-pear

sudo pecl install xdebug

find / -name ‘’

example : /usr/lib/php5/20100525/

sudo vi /etc/php/apache2/php.ini


Netbeans Tools > Options > Debugging

Debugger Port 9000
Session ID netbeans-xdebug