The Perfect Server - Ubuntu 12.04 LTS (nginx, BIND, Dovecot, ISPConfig 3)

Version 1.0
Author: Falko Timme
Follow me on Twitter
Last edited 05/02/2012

This tutorial shows how to prepare an Ubuntu 12.04 LTS (Precise Pangolin) server (with nginx, BIND, Dovecot) for the installation of ISPConfig 3, and how to install ISPConfig 3. ISPConfig 3 is a webhosting control panel that allows you to configure the following services through a web browser: Apache or nginx web server, Postfix mail server, Courier or Dovecot IMAP/POP3 server, MySQL, BIND or MyDNS nameserver, PureFTPd, SpamAssassin, ClamAV, and many more. This setup covers nginx (instead of Apache), BIND (instead of MyDNS), and Dovecot (instead of Courier).

If you want to use nginx instead of Apache with ISPConfig, please note that your nginx version must be at least 0.8.21, and you must install PHP-FPM as well. For CGI/Perl support, you must use fcgiwrap. This is all covered by this tutorial.

Please note that you cannot use this tutorial for Debian Squeeze because Squeeze comes with an older nginx version (0.7.67.) and does not have a PHP-FPM package!

Please note that this setup does not work for ISPConfig 2! It is valid for ISPConfig 3 only!

I do not issue any guarantee that this will work for you!

 

1 Requirements

To install such a system you will need the following:

 

2 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100 and the gateway 192.168.0.1. These settings might differ for you, so you have to replace them where appropriate.

 

3 The Base System

Insert your Ubuntu install CD into your system and boot from it. Select your language:

Then select Install Ubuntu Server:

Choose your language again (?):

Then select your location:

If you've selected an uncommon combination of language and location (like English as the language and Germany as the location, as in my case), the installer might tell you that there is no locale defined for this combination; in this case you have to select the locale manually. I select en_US.UTF-8 here:

Choose a keyboard layout (you will be asked to press a few keys, and the installer will try to detect your keyboard layout based on the keys you pressed):

The installer checks the installation CD, your hardware, and configures the network with DHCP if there is a DHCP server in the network:

Enter the hostname. In this example, my system is called server1.example.com, so I enter server1:

Create a user, for example the user Administrator with the user name administrator (don't use the user name admin as it is a reserved name on Ubuntu 12.04):

Share this page:

12 Comment(s)

Add comment

Comments

From: at: 2012-07-10 23:37:00

This server was problematic as far as configuration goes. There needs to be more detail into preparing the cfg files. I'm an Apache2 user normally and this install was just hassle loaded for me.

From: Senthil at: 2012-08-21 12:20:09

If you want to setup a mail server with following on Ubuntu 12.04 Precise Pangolin:


  • Dovecot 2.0.19


  • Postfix 2.9.3-2


  • Postfix Admin 2.3.5


  • Squirrel Mail 1.4.21


  • MySQL 5.5.24


  • PHP 5.3.10

  • Then lookup this page: http://tech.snathan.org/tech/linux/mail_server_setup


     

    From: Razooloo at: 2012-07-02 20:27:02

    hi

    this is a great manual big thank to Falko

    im trying to install dovecot-mysql dovecot-sieve

    and getting 

     E: Unable to locate package dovecot-mysql
    E: Unable to locate package dovecot-sieve
    if any one can help

    ' be real appreciated

    From: Imam86 at: 2012-08-01 00:50:27

    07-06-2012: Jailkit 2.15 released

    They resolved the issues:

    insserv: warning: script 'K01jailkit' missing LSB tags and overrides
    insserv: warning: script 'jailkit' missing LSB tags and overrides

     So the revision:

    cd /tmp
    wget http://olivier.sessink.nl/jailkit/jailkit-2.15.tar.gz
    tar xvfz jailkit-2.15.tar.gz
    cd jailkit-2.15
    ./debian/rules binary

    cd ..
    dpkg -i jailkit_2.15-1_*.deb
    rm -rf jailkit-2.15*

    From: Mateusz J?drasik at: 2012-09-19 12:23:24

    Fail2Ban already has a pureftpd.conf file which looks like this:

    # Fail2Ban configuration file
    #
    # Author: Cyril Jaquier
    # Modified: Yaroslav Halchenko for pure-ftpd
    #
    # $Revision$
    #
    [Definition]
    # Error message specified in multiple languages
    __errmsg = (?:Authentication failed for user|Erreur d'authentification pour l'utilisateur)
    #
    # Option: failregex
    # Notes.: regex to match the password failures messages in the logfile. The
    #         host must be matched by a group named "host". The tag "<HOST>" can
    #         be used for standard IP/hostname matching and is only an alias for
    #         (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
    # Values: TEXT
    #
    failregex = pure-ftpd(?:\[\d+\])?: \(.+?@<HOST>\) \[WARNING\] %(__errmsg)s \[.+\]\s*$
    # Option:  ignoreregex
    # Notes.:  regex to ignore. If this regex matches, the line is ignored.
    # Values:  TEXT
    #
    ignoreregex = 



    Dovecot also seems covered:
     
    # Fail2Ban configuration file for dovcot
    #
    # Author: Martin Waschbuesch
    #
    # $Revision$
    #

    [Definition]

    # Option: failregex
    # Notes.: regex to match the password failures messages in the logfile. The
    # host must be matched by a group named "host". The tag "<HOST>" can
    # be used for standard IP/hostname matching and is only an alias for
    # (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
    # Values: TEXT
    #
    failregex = .*(?:pop3-login|imap-login):.*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed).*rip=(?P<host>\S*),.*

    # Option: ignoreregex
    # Notes.: regex to ignore. If this regex matches, the line is ignored.
    # Values: TEXT
    #
    ignoreregex =   
     This is on Ubuntu Server 12.04.1 LTS on 19.08.2012.

    From: at: 2013-01-23 22:22:12

    Where is this file?

    From: ababneh at: 2013-03-08 16:15:40

    Hello,

     I followed this tutorial and get everything working, thank you. Just have one question. I have a folder with 15k files but the there is only 9998 files show in filezilla. I tried to locate the config file for pureftpd that contains the limit but I couldn't.  Could you please point that out?

     Thanks

    From: Andreas at: 2012-09-11 15:45:38

    I tried reinstalling ISP Config 3 two times, and im still unable to login as admin/admin.

    Keeps telling me wrong login.

    Any ideas?

    From: Indijus at: 2013-04-20 21:24:15

    Squirrlemail did not work for me. I always get 504 Gateway Time-out. The mail log shows that Apr 21 00:13:34 serveris postfix/smtps/smtpd[23659]: connect from localhost.localdomain[127.0.0.1]
    Apr 21 00:14:03 serveris postfix/smtps/smtpd[23740]: SSL_accept error from localhost.localdomain[127.0.0.1]: Connection timed out
    Apr 21 00:14:03 serveris postfix/smtps/smtpd[23740]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    Apr 21 00:14:03 serveris postfix/smtps/smtpd[23740]: disconnect from localhost.localdomain[127.0.0.1]
    Apr 21 00:14:03 serveris postfix/smtps/smtpd[23740]: connect from localhost.localdomain[127.0.0.1]
    Apr 21 00:14:34 serveris postfix/smtps/smtpd[23659]: SSL_accept error from localhost.localdomain[127.0.0.1]: -1
    Apr 21 00:14:34 serveris postfix/smtps/smtpd[23659]: warning: TLS library problem: 23659:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:628:
    Apr 21 00:14:34 serveris postfix/smtps/smtpd[23659]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    Apr 21 00:14:34 serveris postfix/smtps/smtpd[23659]: disconnect from localhost.localdomain[127.0.0.1]
    Apr 21 00:15:01 serveris postfix/smtps/smtpd[23659]: connect from localhost.localdomain[127.0.0.1]
    Apr 21 00:15:01 serveris postfix/smtps/smtpd[23659]: SSL_accept error from localhost.localdomain[127.0.0.1]: lost connection
    Apr 21 00:15:01 serveris postfix/smtps/smtpd[23659]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]

    Apr 21 00:15:01 serveris postfix/smtps/smtpd[23659]: disconnect from localhost.localdomain[127.0.0.1]


    Whats wrong with my server.Please help me

    From: Yed at: 2013-05-08 12:44:29

    Exactly same here

    nginx installation

    From: Anonymous at: 2013-07-28 11:42:04

    I also get an error on trying to log in for the first time.

    "Username or password is empty"

    From: sertaconay at: 2014-01-15 21:07:20

    Hello.



     I think your configuration for Squirrelmail is wrong. It gives 404 error after trying to send email. Because it rewrites url twice like "squirrelmail/src/compose.php/squirrelmail/src/". 

    I tried this configuration and it's OK.

    location /squirrelmail {

           root /usr/share/;

           index index.php index.html index.htm;

           location ~ ^/squirrelmail/(.+\.php)$ {

                   try_files $uri =404;

                   root /usr/share/;

                   include /etc/nginx/fastcgi_params;

                   fastcgi_pass 127.0.0.1:9000;

                   fastcgi_index index.php;

                   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

                   fastcgi_buffer_size 128k;

                   fastcgi_buffers 256 4k;

                   fastcgi_busy_buffers_size 256k;

                   fastcgi_temp_file_write_size 256k;

           }

           location ~* ^/squirrelmail/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {

                   root /usr/share/;

           }

    }

    location /webmail {

           rewrite ^/* /squirrelmail last;

    }