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:
/usr/share/doc/exim4-base/examples/exim-gencert

(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

Dovecot
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/www.esempio.it
mkdir /var/www/www.esempio.it/cgi-bin
mkdir /var/log/www.esempio.it

Now create the config file in apache2 dir

vi /etc/apache2/site-available/www.esempio.it
#
# www.esempio.it
#

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

ServerAdmin webmaster@esempio.it
ServerName www.esempio.it
ServerAlias esempio.it

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

# CGI Directory
ScriptAlias /cgi-bin/ /var/www/www.esempio.it/cgi-bin/

Options +ExecCGI

# Logfiles
ErrorLog /var/log/www.esempio.it/error.log
CustomLog /var/log/www.esempio.it/access.log combined
</VirtualHost>

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

a2dissite default

add your new site setting

a2ensite www.esempio.it

xdebug netbeans

sudo apt-get install php-dev php-pear

sudo pecl install xdebug

find / -name ‘xdebug.so’

example : /usr/lib/php5/20100525/xdebug.so

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

zend_extension=/usr/lib/php5/20100525/xdebug.so
xdebug.remote_autostart=on
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.1.161
xdebug.remote_port=9000
xdebug.idekey=”netbeans-xdebug”

Netbeans Tools > Options > Debugging

Debugger Port 9000
Session ID netbeans-xdebug