The Perfect Server - Debian Wheezy (nginx, BIND, Dovecot, ISPConfig 3)

Version 1.0
Author: Falko Timme
Follow me on Twitter

This tutorial shows how to prepare a Debian Wheezy 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 Debian Wheezy network installation CD into your system and boot from it. Select Install (this will start the text installer - if you prefer a graphical installer, select Graphical install):

Choose your language:

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:

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:

Enter your domain name. In this example, this is example.com:

Afterwards, give the root user a password:

Confirm that password to avoid typos:

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

Share this page:

12 Comment(s)

Add comment

Comments

From: Unit

Hi,

thank you for the tutorial. I just installed nginx & ISPConfig on my server, but I get an 500 Internal Error after uploading wordpress files and the .sql database in mysql.

I also tried to delete .htaccess, but it didn't help. The 500 Error appears on index, but I have no problem to access the admin backend of wordpress at domain/wp-admin...

Can someone please tell me what could fix it? 

From: Kubek

Check your error.log in log/ directory of your site.

From:

Disable "Own Error-Documents"

From: Bulk sms gateway

Thank you for posting this info.

From: meth

If you want to use it using vagrant or install everything in your own server using puppet you can try https://github.com/meth/puppet-ispconfig/

All contributions are welcomed :) 

 

From: Bradley Gillap

Why not munit in this guide? Is it apache only?

From: sidbyron

Hi,

This is the correct code for NGINX directives in Debian and ISPConfig.

First this is the code for http access without SSL:

 

#Configuration of phpMyAdmin

location /phpmyadmin/ {

   root /var/www/apps;               

   index index.php index.html index.htm;

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

try_files $uri =404;                       

root /var/www/apps;

fastcgi_pass unix:/var/run/php5-fpm.sock;

fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /etc/nginx/fastcgi_params;

fastcgi_buffer_size 128k;

fastcgi_buffers 256 4k;

fastcgi_busy_buffers_size 256k;

fastcgi_temp_file_write_size 256k;

fastcgi_intercept_errors on;

      }

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

 root /var/www/apps;

      }

 

}

location /phpMyAdmin {

   rewrite ^/* /phpmyadmin last;

}

 

#Finish configuration of phpMyAdmin

 

Second This is for phpmyadmin with SSL certificate:

 

#Configuration de phpMyAdmin

location /phpmyadmin/ {

   root /var/www/apps;               

   index index.php index.html index.htm;

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

try_files $uri =404;                       

root /var/www/apps;

fastcgi_pass unix:/var/run/php5-fpm.sock;

        fastcgi_param HTTPS $https; # <-- add this line

fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

include /etc/nginx/fastcgi_params;

fastcgi_buffer_size 128k;

fastcgi_buffers 256 4k;

fastcgi_busy_buffers_size 256k;

fastcgi_temp_file_write_size 256k;

fastcgi_intercept_errors on;

      }

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

 root /var/www/apps;

      }

      location ~* ^/{

          if ($scheme = http) {

   return 301 https://$server_name$request_uri;

 }

      }

 

}

location /phpMyAdmin {

   rewrite ^/* /phpmyadmin last;

}

 

#Finish Configuration phpMyAdmin

This configuration is for people that setup the phpmyadmin on directory /var/www/apps and want to get load for each site without create a new site.

Kind Regards.

From: newtesla

Please, abandon ntpdate in future: it has already created problems.

From: Muhamad Abdulkadir

Perfect tutorial, except that I found "502 Bad Gateway" when I opened http://server1.example.com:8081/webmail 

To solve this problem, do this:

vi /etc/php5/fpm/pool.d/www.conf

and then change: 

; listen.owner = www-data; listen.group = www-data

to: 

listen.owner = www-datalisten.group = www-data

 

From: Thomas

Hello and many thanks for your great tut(s)!

Just one question, don't know if I missed it: What's the servers names?

Mail: subdomain.domain.tld

Web: www.domain.tld

Thank you!

Thomas

From: till

The server name is the hostname of the server, in this tutorial we use server1.example.com. The hostname should always be a subdomain, so you should use e.g. server1.yorowndomain.tld

 

The website domain is the one that you enter when you create a website in ispconfig. this can be any domain or subdomain that points in dns to the IP address of this server. It is not related to the hostname.

From: Phuong

My server: 8 CPU cores - 6 GB of RAM

I got too many 504 error.

Log looks like:

[error] 12753#0: *6193 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xxx.xxx.xxx.xxx

In nginx.conf

...

fastcgi_read_timeout 300;

...

 

Please help