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

Now you have to partition your hard disk. For simplicity's sake I select Guided - use entire disk and set up LVM - this will create one volume group with two logical volumes, one for the / file system and another one for swap (of course, the partitioning is totally up to you - if you know what you're doing, you can also set up your partitions manually).

Select the disk that you want to partition:

Then select the partitioning scheme. As mentioned before, I select All files in one partition (recommended for new users) for simplicity's sake - it's up to your likings what you choose here:

When you're asked Write the changes to disks and configure LVM?, select Yes:

When you're finished, select Finish partitioning and write changes to disk:

Select Yes when you're asked Write changes to disks?:

Afterwards, your new partitions are created and formatted.

Now the base system is installed:

Next you must configure apt. Because you are using the Debian Wheezy Netinstall CD which contains only a minimal set of packages, you must use a network mirror. Select the country where the network mirror that you want to use is located (usually this is the country where your Debian Wheezy system is located):

Then select the mirror you want to use (e.g. ftp.de.debian.org):

Unless you use an HTTP proxy, leave the following field empty and hit Continue:

Apt is now updating its packages database:

You can skip the package usage survey by selecting No:

We need a web server, DNS server, mail server, and a MySQL database, but nevertheless I don't select any of them now because I like to have full control over what gets installed on my system. We will install the needed packages manually later on. Therefore we just select Standard system utilities and SSH server (so that I can immediately connect to the system with an SSH client such as PuTTY after the installation has finished) and hit Continue:

The required packages are downloaded and installed on the system:

When you're asked Install the GRUB boot loader to the master boot record?, select Yes:

The base system installation is now finished. Remove the Debian Wheezy Netinstall CD from the CD drive and hit Continue to reboot the system:

On to the next step...

Share this page:

24 Comment(s)

Add comment

Comments

From: Unit at: 2013-05-12 19:21:04

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 at: 2013-05-19 10:54:20

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

From: at: 2013-08-27 10:51:45

Disable "Own Error-Documents"

From: Bulk sms gateway at: 2013-05-20 10:59:19

Thank you for posting this info.

From: meth at: 2013-08-15 18:07:05

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 at: 2014-02-15 20:21:52

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

From: at: 2014-03-26 11:15:31

You should use  insserv -rf spamassassin instead of update-rc.d -f spamassassin remove

From: Arthur at: 2014-04-22 22:08:05

 Hello!

Why do I need to change the configuration for a static IP address? Why not suitable DHCP?

From: at: 2014-10-24 09:00:49

I have been setting a few of these as Proxmox OpenVZ VMs.

Before diving into this tutorial:

Basically, you start out by downloading the current Wheezy OpenVZ template (at the time of this writing that's 7.0.2) and creating an openVZ container. Once that is up and running and reachable from the outside world, you can come back to the perfect server tutorial.

Since your virtual machine is already up and running, you can skip over the installation/setup parts. I'm assuming if you're setting up a VM, you already know how to set up your network, and can assign an IP to the VM through venet. Setting all this up would be part of a proxmox tutorial, and goes beyond what makes sense here.

Basically, after skipping the installation steps of this manual, you start directly with step 7 ("Update Your Debian Installation"), and right after that, continue with:

7.a 

apt-get install console-data keyboard-configuration


This should bring up debconfig with a menu where you can configure your keyboard layout. Pick the keyboard layout you wish to use here.

7.b

dpkg-reconfigure locales

Here you choose which locales your system should use. The debian template seems to not set any default here. In my case, I choose both of these:

de_DE.UTF-8 
en_US.UTF-8

Personally, I then set de_DE.UTF-8 as my default locale (German). If you're from the US, you can of course simply not install this locale at all. If you're from the UK, you might prefer to install and select en_GB.UTF-8, etc. - use your common sense here.

7.c

dpkg-reconfigure tzdata

This is to configure your timezone. By default, your server will use UTC time. This may be fine for you. If not, you can choose a different timezone here (e.g. "Europe/Berlin" for a server in Germany).

You can now continue with step 8 of the perfect server tutorial.

From: Sam at: 2013-07-28 13:03:09

If you are getting an error message like this - it's because you are propably using some sort of apt-cacher software.

Failed to fetch http://ftp.de.debian.org/debian/pool/main/libm/libmail-sendmail-perl/libmail-sendmail-perl_0.79.16-1_all.deb  Size mismatch
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
 

Try without the apt-cacher conf file.

rm /etc/apt/apt.conf.d/90httpproxy

From: Anonymous at: 2013-11-12 16:43:07

in /etc/nginx/sites-enabled/000-apps.vhost I had to change location /images/mailman/ { alias /usr/share/images/mailman/; } to location ^~ /images/mailman/ { alias /usr/share/images/mailman/; } to display images on the mailman web interface properly. from http://wiki.nginx.org/HttpCoreModule#location location ^~ /images/ { # matches any query beginning with /images/ and halts searching, # so regular expressions will not be checked. [ configuration D ] }

From: Arthur at: 2014-04-23 17:18:24

 Where should I add this line?

usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0

 My config.

proc  /proc       proc    defaults    0    0
none  /dev/pts    devpts  rw,gid=5,mode=620    0    0
none  /run/shm    tmpfs   defaults    0    0


From: Danny at: 2014-06-06 15:34:43

All what you need to do is a reweite for the whole server/vhost  

server {
        listen       80;
        server_name  you.server.domain.net;
         rewrite ^/(.*)$ /phpmyadmin/$1;
         location /phpmyadmin {
                root /usr/share;
                index index.php index.html index.htm;
                location ~ ^/phpmyadmin/(.+\.php)$ {
                        try_files $uri =404;
                        root /usr/share/;
                        fastcgi_pass unix:/var/run/php5-fpm.sock;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $request_filename;
                        include /etc/nginx/fastcgi_params;
                        fastcgi_param PATH_INFO $fastcgi_script_name;
                        fastcgi_buffer_size 128k;
                        fastcgi_buffers 256 4k;
                        fastcgi_busy_buffers_size 256k;
                        fastcgi_temp_file_write_size 256k;
                        fastcgi_intercept_errors on;
                }
                location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
                        root /usr/share;
                }
         }
         location /phpMyAdmin {
                rewrite ^/* /phpmyadmin last;
         }
    }

From: Raj at: 2014-08-29 11:59:21

Where do i add this?

kindly elaborate 

noob here

From: A Scott at: 2014-12-17 19:31:22

At the Jailkit install step, if you get errors like below:

make: dpkg-architecture: Command not found
make: dpkg-architecture: Command not found
dh_testdir
make: dh_testdir: Command not found
make: *** [config.status] Error 127

Run the following command to install dependancies.

apt-get install dpkg-dev debhelper

ALSO:

Jailkit is at version 2.17 as of December 2014, so do this instead of the jailkit step in the how-to:

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

From: Saevar at: 2013-05-12 16:39:47

That would be so great if we could have this setup in .img format so it would be possible to dd this setup on HDD, keep up the good work, p.s. i would buy this setup :) 

From: guntbert at: 2013-05-30 16:13:43

The first link under Links should be Debian: http://www.debian.org/  :-))

From: x42 at: 2013-06-25 05:37:43

some libs moved to gnu. chroot doesn't work. edit /etc/jailkit/jk_init.ini

https://savannah.nongnu.org/bugs/index.php?38596 wrote:

[uidbasics]
# this section probably needs adjustment on 64bit systems
# or non-Linux systems
comment = common files for all jails that need user/group information
libraries = /lib/libnsl.so.1, /lib64/libnsl.so.1, /lib/libnss*.so.2, /lib64/libnss*.so.2, /lib/x86_64-linux-gnu/libnsl.so.1, /lib/x86_64-linux-gnu/libnss*.so.2
regularfiles = /etc/nsswitch.conf, /etc/ld.so.conf

[netbasics]
comment = common files for all jails that need any internet connectivity
libraries = /lib/libnss_dns.so.2, /lib64/libnss_dns.so.2, /lib/x86_64-linux-gnu/libnss_dns.so.2
regularfiles = /etc/resolv.conf, /etc/host.conf, /etc/hosts, /etc/protocols

From: at: 2013-07-23 22:11:20

Wordpress issue - just a note that once I installed WordPress I could browse to the home page fine but all other pages gave me Error 500.



Thanks, Matt

From: Mindbuild at: 2014-05-09 10:28:58

Thanks for the excellent tutorial. Everything worked really well.

After installing ispconfig and using the above code to configure squirrelmail with Nginx, I was unable to send email. I got the error 404 not found. 

I had to replace the above code (non https) with this:

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;
               # To access SquirrelMail, the default user (like www-data on Debian/Ubuntu) must be used
               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;
}

 found here: http://www.howtoforge.com/forums/showthread.php?t=55342

After that I had  no problem in sending emails.

 

From: Florian at: 2014-09-16 18:55:55

Excellent work! Everything writen here works out of the box! This is a precious save of time! 

From: Idso at: 2014-12-05 19:42:30

Thanks for the excellent tutorial !! I just set it up on a testserver, but I should have no problem doing this on a production server thanks to this guide.

From: sidbyron at: 2015-01-25 02:19:34

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 at: 2015-03-09 19:44:07

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