Hello friends today I’m going to write a tutorial on creating a multi-server using ISPConfig. This tutorial will help you to setup with 2 VPS / Dedicated servers that will cost you very minimum than that of 5 dedicated servers for Web Server (NGINX) & Panel, Data-Base Server (MySQL), Primary & Secondary DNS servers and Email Server on top of Debian 8 (Jessie).
This tutorial is for everyone who know basics of unix based OS. So, for every step I’ll keep it as simple as possible. This tutorial will also help you installing RoundCube Web-Mail Client.
Q. Is it mandatory to install ISPConfig in distributed architecture?
A. No, It can be installed as standalone or distributed into multiple servers. But in our scope, I want to keep it simple, yet powerful and cheaper.
1. The Base Systems
We need 2 VPS / Dedicated servers to start with. Both the servers should have Debian 8 (Jessie). Practically ISPConfig can be installed in many diverse systems. But, here we will take Debian’s latest release – Jessie.
This step is required for both of the servers. In this tutorial we will assume the servers as follows:
Main Server web.example.com - 192.168.0.100 Email Server mail.example.com - 192.168.0.200
Update the hosts file by the hostnames with their matching IP address. Update the IP address & hostname as your requirements.
nano /etc/hosts
Remove all lines there and Copy & Paste these lines. (Remember to update the IP addresses with their respective hostnames as your requirements)
127.0.0.1 localhost 192.168.0.100 web.example.com 192.168.0.200 mail.example.com # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Now set the hostnames of the servers:
Main Server:
echo web.example.com > /etc/hostname service hostname.sh service hostname.sh start
Mail Server:
echo mail.example.com > /etc/hostname service hostname.sh service hostname.sh start
Now make sure both the following commands display their fully qualified domain names. ie: web.example.com and mail.example.com at respective servers. [This is very important]
hostname hostname -f
Now update the APT package manager’s cache by this command:
apt-get update
Next, upgrade your system by issuing:
apt-get upgrade
It would be better to install a time syncing service. This will make sure your server is always at right time. To do this run:
apt-get -y install ntp ntpdate
Now, make sure that the time-zone is set to your location. To update your time zone run…
dpkg-reconfigure tzdata
… and select the appropriate time zone.
The next step is to install the MySQL server & client.
apt-get -y install mysql-client mysql-server
Enter the password you want to set for the MySQL’s root user when asked by the package installer.
Now for the following steps we divide the procedures differently for the 2 servers.
2. Setup Main Server
As we want our MySQL server of the Main Server to listen not only localhost but any interfaces, so we have to update the MySQL’s config file: /etc/mysql/my.cnf
nano /etc/mysql/my.cnf
Now locate “bind-address” using: CTRL+W and comment out that line like this:
# Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. #bind-address = 127.0.0.1
Then restart MySQL server by…
service mysql restart
2.1 Install Nginx, PHP5, and Fcgiwrap
Install nginx (my favourite http server) by issuing:
apt-get -y install nginx
If your system already have apache installed, we have to stop and remove it because we don’t need it for our main server. This will not only release PORT 80 but also will release some memory.
service apache2 stop apt-get remove --purge apache2* apt-get autoremove
This will remove apache2 and unnecessary files & programs. Then start nginx server.
service nginx start
PHP-FPM (FastCGI Process Manager) is required to run PHP scripts through nginx. Install it by…
apt-get -y install php5-fpm
Now install other php5 modules…
apt-get -y install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-memcached php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl memcached[ NOTE: You can install any other php module. Find available modules using command: apt-cache search php5 ]
Optionally, you can install APC a free PHP opcode cacher: ( RECOMENDED )
apt-get install php-apc
Now update time-zone of PHP and set cgi.fix_pathinfo=0 by editing php.ini file.
nano /etc/php5/fpm/php.ini
... cgi.fix_pathinfo=0 ... date.timezone="Europe/Berlin" ...