LATEST VERSION (Jan 22): 0.9.8-26

Documentation




How to install Vesta Control panel

1. Connect to your server as root via SSH

ssh [email protected]


2. Download installation script

curl -O http://vestacp.com/pub/vst-install.sh


3. Run it

bash vst-install.sh


The Vesta Control panel can be installed on a RHEL, CentOS, Debian and Ubuntu server. For a smooth installation you will need clean system "minimal install base". If installation fails you can force it using --force option. If you want to get full list of available options run installer with --help argument.

Installer categorizes servers into 4 groups. Micro - less than 1Gb of RAM. Small - less than 3Gb of RAM. Medium - less than 7Gb of RAM. Large - more than 7Gb of RAM. Antispam and Antivirus packages are only installed on a medium and large servers. Micro server also do not support phpfcgi template. However, you can install missing software manually. See corresponding articles for details.



How to uninstall Vesta Control panel

1. Stop vesta service

service vesta stop


2. Remove vesta packages and software repository
RHEL/CentOS:

yum remove vesta*
rm -f /etc/yum.repos.d/vesta.repo


Debian/Ubuntu:

apt-get remove vesta*
rm -f /etc/apt/sources.list.d/vesta.list


3. Delete data directory and cron

rm -rf /usr/local/vesta


You might also consider to delete admin user account and its cron jobs.


Template description

Apache
default - no additional settings, works well for most sites
basedir - to fight against phpshells using openbasedir directive
hosting - separate php limits for each domain (php_admin_value memory/safemode/etc)
phpcgi - template to run php as cgi. can be useful to run php4 or php5.2
phpfcgid - to php as fcgi (automatically installed on a server with > 1Gb of RAM)
wsgi - template to run python projects (can be installed manually)

Apache template actually consists of three files. File with tpl extension is used to build usual virtual host. File with stpl extension is used to build SSL vhost. File with sh extension is optional. It can be used as trigger to run additional shell commands on domain creation. For details see phpfcgid.sh template


Nginx
default - serves static content, works well for most sites
hosting - disable_symlinks directive to protect from symlink attacks
сaching - dynamic pages are cached for 15 min to handle spontaneous traffic aka reddit-effect
force-https - force users to https/SSL (can be installed manually)


DNS
default - general dns records
gmail - predefined records to host mail on google app
child-ns - template for vanity name servers


Templates can be found in the /usr/local/vesta/data/templates/ directory. Feel free to modify or copy them to create new custom templates. After modifying existing template you need to rebuild user configuration. This can be done using v-rebuild-user command or bulk operation in the web interface (drop down list on a "User" page).


Config and log locations on a RHEL and CentOS

Service Config Log
Apache /etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*
/home/$user/conf/web/httpd.conf
/home/$user/conf/web/shttpd.conf (ssl)
/var/log/httpd/access_log
/var/log/httpd/error_log
/var/log/httpd/domains/$domain.log
/var/log/httpd/domains/$domain.error.log
PHP /etc/php.ini
/etc/php.d/*
/var/log/httpd/domains/$domain.error.log
Nginx /etc/nginx/nginx.conf
/etc/nginx/conf.d/*
/home/$user/conf/web/nginx.conf
/home/$user/conf/web/snginx.conf (ssl)
/var/log/nginx/access.log
/var/log/nginx/error.log
/var/log/httpd/domains/$domain.log
/var/log/httpd/domains/$domain.error.log
Named /etc/named.conf
/home/$user/conf/dns/$domain.db
/var/log/messages
Exim /etc/exim/exim.conf
/home/$user/conf/mail/$domain/*
/var/log/exim/main.log
/var/log/exim/reject.log
/var/log/exim/panic.log
Dovecot /etc/dovecot/dovecot.conf
/etc/dovecot/conf.d/*
/etc/dovecot.conf (rhel5/centos5)
/home/$user/conf/mail/$domain/passwd
/var/log/dovecot.log
ClamAV /etc/clamd.conf
/etc/freshclam.conf
/var/log/clamav/clamd.log
/var/log/clamav/freshclam.log
/var/log/messages
/var/log/exim/main.log
SpamAssassin /etc/mail/spamassassin/local.cf /var/log/exim/main.log
Roundcube /etc/roundcubemail/main.inc.php
/etc/roundcubemail/db.inc.php
/etc/httpd/conf.d/roundcubemail.conf
/var/log/roundcubemail/*
/var/log/httpd/domains/$domain.log
/var/log/httpd/domains/$domain.error.log
MySQL /etc/my.cnf
/root/.my.cnf
/usr/local/vesta/conf/mysql.conf
/var/log/mysqld.log
phpMyAdmin /etc/phpMyAdmin/config.inc.php
/etc/httpd/conf.d/phpMyAdmin.conf
/var/log/httpd/domains/$domain.log
/var/log/httpd/domains/$domain.error.log
PostgreSQL /var/lib/pgsql/data/postgresql.conf
/var/lib/pgsql/data/pg_hba.conf
/usr/local/vesta/conf/pgsql.conf
/var/lib/pgsql/pgstartup.log
phpPgAdmin /etc/phpPgAdmin/config.inc.php
/etc/httpd/conf.d/phpPgAdmin.conf
/var/log/httpd/domains/$domain.log
/var/log/httpd/domains/$domain.error.log
Vsftpd /etc/vsftpd/vsftpd.conf /var/log/xferlog
/var/log/messages
Cron /etc/crontab /var/log/cron
Vesta /usr/local/vesta/conf/vesta.conf
/usr/local/vesta/conf/mysql.conf
/usr/local/vesta/conf/pgsql.conf
/usr/local/vesta/conf/ftp.backup.conf
/usr/local/vesta/conf/dns-cluster.conf
/usr/local/vesta/nginx/conf/nginx.conf
/usr/local/vesta/php/lib/php.ini
/usr/local/vesta/php/etc/php-fpm.conf
/var/log/vesta/system.log
/var/log/vesta/backup.log
/var/log/vesta/auth.log
/var/log/vesta/nginx-error.log
/usr/local/vesta/php/var/log/php-fpm.log



Config and log locations on a Debian and Ubuntu

Service Config Log
Apache /etc/apache2/apache2.conf
/etc/apache2/conf.d/*
/home/$user/conf/web/apache2.conf
/home/$user/conf/web/sapache2.conf (ssl)
/var/log/apache2/access.log
/var/log/apache2/error.log
/var/log/apache2/domains/$domain.log
/var/log/apache2/domains/$domain.error.log
PHP /etc/php5/apache2/php.ini
/etc/php5/conf.d/*
/var/log/apache2/domains/$domain.error.log
Nginx /etc/nginx/nginx.conf
/etc/nginx/conf.d/*
/home/$user/conf/web/nginx.conf
/home/$user/conf/web/snginx.conf (ssl)
/var/log/nginx/access.log
/var/log/nginx/error.log
/var/log/apache2/domains/$domain.log
/var/log/apache2/domains/$domain.error.log
Named /etc/bind/named.conf
/home/$user/conf/dns/$domain.db
/var/log/syslog
Exim /etc/exim4/exim4.conf.template
/home/$user/conf/mail/$domain/*
/var/log/exim4/mainlog
/var/log/exim/rejectlog
/var/log/exim/paniclog
Dovecot /etc/dovecot/dovecot.conf
/etc/dovecot/conf.d/*
/home/$user/conf/mail/$domain/passwd
/var/log/dovecot.log
ClamAV /etc/clamav/clamd.conf
/etc/clamav/freshclam.conf
/var/log/clamav/clamav.log
/var/log/clamav/freshclam.log
/var/log/exim4/mainlog
SpamAssassin /etc/spamassassin/local.cf /var/log/exim4/mainlog
Roundcube /etc/roundcube/main.inc.php
/etc/roundcube/db.inc.php
/etc/apache2/conf.d/roundcube
/var/log/roundcube/*
/var/log/apache2/domains/$domain.log
/var/log/apache2/domains/$domain.error.log
MySQL /etc/mysql/my.cnf
/root/.my.cnf
/usr/local/vesta/conf/mysql.conf
/var/log/mysql.log
/var/log/mysql/error.log
phpMyAdmin /etc/phpmyadmin/config.inc.php
/etc/apache2/conf.d/phpmyadmin.conf
/var/log/apache2/domains/$domain.log
/var/log/apache2/domains/$domain.error.log
PostgreSQL /etc/postgresql/*/main/postgresql.conf
/etc/postgresql/*/main//pg_hba.conf
/usr/local/vesta/conf/pgsql.conf
/var/log/postgresql/postgresql-*-main.log
phpPgAdmin /etc/phppgadmin/config.inc.php
/etc/apache2/conf.d/phppgadmin
/var/log/apache2/domains/$domain.log
/var/log/apache2/domains/$domain.error.log
Vsftpd /etc/vsftpd.conf /var/log/xferlog
/var/log/syslog
Cron /etc/crontab /var/log/syslog
Vesta /usr/local/vesta/conf/vesta.conf
/usr/local/vesta/conf/mysql.conf
/usr/local/vesta/conf/pgsql.conf
/usr/local/vesta/conf/ftp.backup.conf
/usr/local/vesta/conf/dns-cluster.conf
/usr/local/vesta/nginx/conf/nginx.conf
/usr/local/vesta/php/lib/php.ini
/usr/local/vesta/php/etc/php-fpm.conf
/var/log/vesta/system.log
/var/log/vesta/backup.log
/var/log/vesta/auth.log
/var/log/vesta/nginx-error.log
/usr/local/vesta/php/var/log/php-fpm.log



How to install ClamAV and SpamAssassin on a RHEL or CentOS

* This tutorial is created for servers with less than 3Gb of ram availalbe. On "big" servers installation is fully automatic.

ClamAV installation

yum install clamd
wget http://c.vestacp.com/0.9.8/rhel/clamd.conf -O /etc/clamd.conf
wget http://c.vestacp.com/0.9.8/rhel/freshclam.conf -O /etc/freshclam.conf
gpasswd -a clam exim
gpasswd -a clam mail
freshclam
chkconfig clamd on
service clamd start


SpamAssassin installation

yum install spamassassin
chkconfig spamassassin on
service spamassassin start


Exim configuration

sed -i "s/^#SPAMASSASSIN/SPAMASSASSIN/g" /etc/exim/exim.conf
sed -i "s/^#CLAMD/CLAMD/g" /etc/exim/exim.conf
sed -i "s/^#SPAM_SCORE/SPAM_SCORE/g" /etc/exim/exim.conf
service exim restart


Vesta configuration

sed -i "s/ANTIVIRUS.*/ANTIVIRUS_SYSTEM='clamav'/" /usr/local/vesta/conf/vesta.conf
sed -i "s/ANTISPAM.*/ANTISPAM_SYSTEM='spamassassin'/" /usr/local/vesta/conf/vesta.conf





How to install ClamAV and SpamAssassin on a Debian or Ubuntu

* This tutorial is created for servers with less than 3Gb of ram availalbe. On "big" servers installation is fully automatic.

ClamAV installation

apt-get install clamav-daemon
wget http://c.vestacp.com/0.9.8/ubuntu/clamd.conf -O /etc/clamav/clamd.conf
gpasswd -a clamav mail
gpasswd -a clamav Debian-exim
freshclam
update-rc.d clamav-daemon defaults
service clamav-daemon restart


SpamAssassin installation

apt-get install spamassassin
update-rc.d spamassassin defaults
sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
service spamassassin restart


Exim configuration

sed -i "s/^#SPAMASSASSIN/SPAMASSASSIN/g" /etc/exim4/exim4.conf.template
sed -i "s/^#CLAMD/CLAMD/g" /etc/exim4/exim4.conf.template
sed -i "s/^#SPAM_SCORE/SPAM_SCORE/g" /etc/exim4/exim4.conf.template
service exim4 restart


Vesta configuration

sed -i "s/ANTIVIRUS.*/ANTIVIRUS_SYSTEM='clamav-daemon'/" /usr/local/vesta/conf/vesta.conf
sed -i "s/ANTISPAM.*/ANTISPAM_SYSTEM='spamassassin'/" /usr/local/vesta/conf/vesta.conf





How to install WHMCS module

1. Locate whmcs installation directory on your server
2. Create vesta directory in the modules/server subdirectory
3. Download php module

Example:

cd /home/user/web/billing-site.ltd/public_html/modules/server
mkdir vesta
wget http://c.vestacp.com/0.9.8/rhel/whmcs-module.php -O vesta.php


The WHMCS plugin allows to manage servers running Vesta Control Panel. You can automatically create delete or suspend user accounts. Users are able to change passwords and manage their web/mail/dns domains.



How to configure FTP backup

Login on a server as root and run following command

v-add-backup-ftp-host remote.ftp-host.ltd backup-user p4ssw0rd


Command arguments (of course) should be replaced with relevant login credentials


How to translate Vesta interface

Localization files can be found in the /usr/local/vesta/web/inc/i18n/ directory. You can use
en.php as a template to create new file. Just change the $LANG['en'] to $LANG['aa'] and you are all set.

In other languages some things are simply too long. You can rely on context to cut and shorten up long phrases. Instead of explicitly translate "Add Mail Account" used "Add Account". Good luck!


How to enable WSGI support on a RHEL or CentOS

1. Install wsgi apache module

yum install mod_wsgi


2. Download wsgi template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/wsgi/httpd.tar.gz
tar -xzvf httpd.tar.gz
rm -f httpd.tar.gz


3. Create new package or set wsgi as apache template in the existing package
4. Add new user and assing him package with wsgi template
5. Add new domain and check the result



How to enable WSGI support on a Debian or Ubuntu

1. Install wsgi apache module

apt-get install libapache2-mod-wsgi
a2enmod wsgi


2. Download wsgi template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/ubuntu/wsgi/apache2.tar.gz
tar -xzvf apache2.tar.gz
rm -f apache2.tar.gz


3. Create new package or set wsgi as apache template in the existing package
4. Add new user and assing him package with wsgi template
5. Add new domain and check the result



How to enable PHP-FCGI support on a RHEL or CentOS

* This tutorial is created for servers with less than 1Gb of ram avaialbe. On "medium" servers installation is fully automatic.

1. Install fcgid apache module

yum install mod_fcgid


2. Download fcgid template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/fcgid/httpd.tar.gz
tar -xzvf httpd.tar.gz
rm -f httpd.tar.gz


3. Create new package or set phpfcgid as apache template in the existing package
4. Add new user and assing him package with phpfcgid template
5. Add new domain and check the result



How to enable PHP-FCGI support on a Debian or Ubuntu

* This tutorial is created for servers with less than 1Gb of ram avaialbe. On "medium" servers installation is fully automatic.

1. Install fcgid apache module

apt-get install libapache2-mod-fcgid
a2enmod fcgid


2. Download fcgid template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/ubuntu/fcgid/apache2.tar.gz
tar -xzvf apache2.tar.gz
rm -f apache2.tar.gz


3. Create new package or set phpfcgid as apache template in the existing package
4. Add new user and assing him package with phpfcgid template
5. Add new domain and check the result



How to force https/SSL on a domain

1. Install custom nginx template

cd /usr/local/vesta/data/templates/web
wget http://c.vestacp.com/0.9.8/rhel/force-https/nginx.tar.gz
tar -xzvf nginx.tar.gz
rm -f nginx.tar.gz


3. Create new package or set force-https as nginx template in the existing package
4. Add new user and assing him package with force-https template
5. Add new domain with SSL certificate and check the result



How to configure temporary links for new domains

If you are running hosting company most likely you would want to provide your customers temporary link to access their site before actual domain propagation. This is especially useful when customer is moving site from another host and want to check if everything works as expected.

For instance, you have 2 IP addresses on a server, 192.168.3.57 and 192.168.3.58. Let's say your site is tophost.ltd. Then you need to set up 2 wildcards for each ip address. Go to the DNS menu. Click on a "add record" under the tophost.ltd domain and enter following

Record: *.alpha
Type: A
IP: 192.168.3.57


Press Add button and add second record

Record: *.beta
Type: A
IP: 192.168.3.58


The DNS part is complete. Let's assign those domains to corresponding ip addresses. Go to the IP menu. Select 192.168.3.57. Click on edit button opposite and add alpha.tophost.ltd in the "Assigned Domain" text field. Save and repeat accordingly for the 192.168.3.58 address and beta.tophost.ltd domain.

Now when your user add new domain it will automatically get tophost alias. If he added bbc.com on a 192.168.3.57 then he will be able to see his domain by opening http://bbc-com.alpha.tophost.ltd As you can see dots in original domain has been replaced with dashes.


How to set up own Name Servers (vanity/private/child nameservers)

If you want to manage DNS zones using Vesta Control Panel, you will have to create 2 dns records, point them to server IP address and use them as a nameservers for the domain. In this example, we will use ns1.yourdomain.com and ns2.yourdomain.com.

Domain registrar
Every domain registrar has a different method of setting up private name servers. Below you will find instructions on how to create record in GoDaddy Account Manager.
1. Log in to your GoDaddy account manager
2. Next to domains, click launch
3. Click on the yourdomain.com
4. In the settings tab, click manage next to host names
5. Click add hostname
6. Enter the ns1
7. Enter the IP address of your server
8. Click add
9. Repeat above for the ns2
10. Change name servers for yourdomain.com to ns1.yourdomain.com and ns2.yourdomain.com

Vesta Control Panel
Once the private nameservers registration is complete, you need to configure Vesta Control Panel.
1. Add domain yourdomain.com (leave DNS Support mark checked)
2. Go to DNS menu
3. Click on edit under yourdomain.com
4. Change template to child-ns
5. Go to Packages menu
6. Edit package called default
7. Set ns1.yourdomain.com and ns2.yourdomain.com as nameservers

After you have done all steps, you can now set all of your domain names to use ns1.yourdomain.com and ns2.yourdomain.com. Please note that it may take up to 24 hours while dns records will start working.



How to set up master-slave DNS cluster

If you are looking for the options to avoid any DNS-related downtime or the way to manage dns across all server you have, you might consider to set up dns cluster.

1. Create user dns-cluster on a server which will be used as dns slave
2. Run following command on a master:

v-add-remote-dns-host slave.yourhost.com 8083 admin p4sw0rd


Password and host name should be replaced with relevant data of course.

This way you can set up master->slave or master-master-master cluster. There is no limitation on how to chain dns servers.



How to enable AXFR (Zone Transfer) in Bind

Replace following string in the named configuration file:

allow-transfer {"none";};

with

allow-transfer { XXX.YYY.ZZZ.111; XXX.YYY.ZZZ.222; };
also-notify { XXX.YYY.ZZZ.111; XXX.YYY.ZZZ.222; };


The location of this file on RHEL and CentOS: /etc/named.conf
The location of this file on Debian and Ubuntu: /etc/bind/named.conf



How to migrate user to the new server

1. Make user backup on the old server. In this example we will use admin as the reference.

v-backup-user admin


2. Copy tarball to the new server and place it in the /home/backup directory

scp /home/backup/admin.2014-01-14.tar new-server:/home/backup/


3. Restore backup on the new server

v-restore-user admin admin.2014-01-14.tar



If you want to restore data under another user name, simply rename archive. If user name doesn't exist on the server, account will be created automatically.

mv /home/backup/admin.2014-01-14.tar /home/backup/newuser.2014-01-14.tar
v-restore-user newuser newuser.2014-01-14.tar





How to add remote MySQL database server

1. It is assumed you already have your second server up and running.

2. On the first server run following command

v-add-database-host mysql new-server.com root password


3. To make sure database has been added run following command

v-list-database-hosts





How to set up PostgreSQL on a RHEL or CentOS

1. Install PostgreSQL packages

yum install postgresql postgresql-server postgresql-contrib phpPgAdmin


* If you have remi installed then don't forget to explicitly enable it.

yum install --enablerepo=remi postgresql postgresql-server postgresql-contrib phpPgAdmin


2. Initialize database cluster

service postgresql initdb


3. Download hba configuration

wget http://c.vestacp.com/0.9.8/rhel/pg_hba.conf -O /var/lib/pgsql/data/pg_hba.conf


4. Start the server

service postgresql start


5. Set oracle user password

su - postgres
psql -c "ALTER USER postgres WITH PASSWORD 'pgp4sw0rd'"
exit


6. Enable pgsql databases support in vesta.
open /usr/local/vesta/conf/vesta.conf and set DB_SYSTEM to 'mysql,pgsql'

7. Register pg instance in control panel

v-add-database-host pgsql localhost postgres pgp4sw0rd


8. Download phpPgAdmin configuration

wget http://c.vestacp.com/0.9.8/rhel/pga.conf -O /etc/phpPgAdmin/config.inc.php
wget http://c.vestacp.com/0.9.8/rhel/httpd-pga.conf -O /etc/httpd/conf.d/phpPgAdmin.conf


9. Restart web server

service httpd restart





How to set up PostgreSQL on a Debian or Ubuntu

1. Install PostgreSQL packages

apt-get install postgresql postgresql-contrib phppgadmin


2. Download hba configuration

wget http://c.vestacp.com/0.9.8/debian/pg_hba.conf -O /etc/postgresql/*/main/pg_hba.conf


3. Restart the server

service postgresql restart


4. Set oracle user password

su - postgres
psql -c "ALTER USER postgres WITH PASSWORD 'pgp4sw0rd'"
exit


5. Enable pgsql databases support in vesta.
open /usr/local/vesta/conf/vesta.conf and set DB_SYSTEM to 'mysql,pgsql'

6. Register pg instance in control panel

v-add-database-host pgsql localhost postgres pgp4sw0rd


7. Download phpPgAdmin configuration

wget http://c.vestacp.com/0.9.8/debian/pga.conf -O /etc/phppgadmin/config.inc.php
wget http://c.vestacp.com/0.9.8/debian/apache2-pga.conf -O /etc/apache2/conf.d/phppgadmin


8. Restart web server

service apache2 restart





How to replace vsftpd with ProFTPD on a RHEL or CentOS

1. Disable vsftpd

service vsftpd stop
chkconfig vsftpd off


2. Install software package

yum install proftpd


3. Download configuration

wget http://c.vestacp.com/0.9.8/rhel/proftpd.conf -O /etc/proftpd.conf


4. Change vesta settings

sed -i "s/vsftpd/proftpd/" /usr/local/vesta/conf/vesta.conf


5. Enable proftpd

chkconfig proftpd on
service proftpd start





How to replace vsftpd with ProFTPD on a Debian or Ubuntu

1. Disable vsftpd

service vsftpd stop
update-rc.d -f vsftpd remove


2. Install software package

apt-get install proftpd-basic proftpd-mod-vroot


3. Download configuration

wget http://c.vestacp.com/0.9.8/debian/proftpd.conf -O /etc/proftpd/proftpd.conf


4. Change vesta settings

sed -i "s/vsftpd/proftpd/" /usr/local/vesta/conf/vesta.conf


5. Restart proftpd

service proftpd restart





How to remove Nginx on a RHEL or CentOS

1. Stop nginx

service nginx stop


2. Remove package

yum remove nginx


3. Change vesta configuration

cd /usr/local/vesta/conf
sed -i "/PROXY_*/d" vesta.conf
sed -i "s/8080/80/" vesta.conf
sed -i "s/8443/443/" vesta.conf


4. Change httpd configuration

cd /etc/httpd/conf.d
sed -i "s/8080/80/" *.conf
sed -i "s/8443/443/" *.conf


5. Rebuild vhost configs

for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done





How to remove Nginx on a Debian or Ubuntu

1. Stop nginx

service nginx stop


2. Remove package

apt-get remove nginx


3. Change vesta configuration

cd /usr/local/vesta/conf
sed -i "/PROXY_*/d" vesta.conf
sed -i "s/8080/80/" vesta.conf
sed -i "s/8443/443/" vesta.conf


4. Change httpd configuration

cd /etc/apache2/conf.d
sed -i "s/8080/80/" *.conf
sed -i "s/8443/443/" *.conf


5. Rebuild vhost configs

for user in $(v-list-sys-users plain); do v-rebuild-web-domains $user; done





How to properly set up a Mail Server

1. Install Vesta Control Panel

2. Get a domain name

3. Link domain name with your new server.
see how to set up vanity nameservers

4. Make sure port 25 is not firewalled
you can use SMTP diagnostic tool

5. Make sure server hostname is FQDN compliant

root@localhost:~# hostname
localhost
root@localhost:~# v-change-sys-hostname mail.vestacp.com
root@localhost:~# hostname
mail.vestacp.com


6. Set PTR record.
Please contact your ISP to find out how to do it.

7. Check server IP reputation.
Blacklist Check

8. Eneable DKIM support.
This is optional step but highly recommended. DKIM can be enabled in the Vesta under MAIL tab.

9. Add email users and you are all set


How to properly set up a Mail Client

* You can use Thunderbird, Apple Mail, Outlook or Outlook Express

* Use full e-mail address as username

* IMAP and SMTP STARTTLS with normal passwords

Username: [email protected]
Password: aXly8Kbiqo

IMAP hostname: alpha-mimic.ltd
IMAP port: 143
IMAP security: STARTTLS
IMAP auth method: Normal password

SMTP hostname: alpha-mimic.ltd
SMTP port: 587
SMTP security: STARTTLS
SMTP auth method: Normal password

Congratulations, you now have all set up!


How to install Fail2Ban on RHEL or CentOS

1. Install fail2ban package

yum install fail2ban


2. Download hba configuration

cd /etc
wget http://c.vestacp.com/0.9.8/rhel/fail2ban.tar.gz -O fail2ban.tar.gz


3. Extract configuration

tar -xzf fail2ban.tar.gz
rm -f fail2ban.tar.gz


4. Register fail2bain in vesta config

sed -i "/FIREWALL_EXTENSION/d" /usr/local/vesta/conf/vesta.conf
echo "FIREWALL_EXTENSION='fail2ban'" >> /usr/local/vesta/conf/vesta.conf


5. Launch fail2ban

chkconfig fail2ban on
service fail2ban start




How to install Fail2Ban on Debian or Ubuntu

1. Install fail2ban package

apt-get install fail2ban


2. Download hba configuration

cd /etc
wget http://c.vestacp.com/0.9.8/ubuntu/fail2ban.tar.gz -O fail2ban.tar.gz


3. Extract configuration

tar -xzf fail2ban.tar.gz
rm -f fail2ban.tar.gz


4. Register fail2bain in vesta config

sed -i "/FIREWALL_EXTENSION/d" /usr/local/vesta/conf/vesta.conf
echo "FIREWALL_EXTENSION='fail2ban'" >> /usr/local/vesta/conf/vesta.conf


5. Launch fail2ban

update-rc.d fail2ban defaults
service fail2ban start




How to configure Service (SRV) Records

For the typical XMPP infrastructure we will need 3 DNS recods. One "A" record for the server itself and two "SRV" records for service auto-detect. Here are example records:

xmpp 18000 IN A 192.168.1.1
_xmpp-client._tcp.example.com. 18000 IN SRV 0 5 5222 xmpp.example.com.
_xmpp-server._tcp.example.com. 18000 IN SRV 0 5 5269 xmpp.example.com.


To create them, follow these steps:
1. Login in to Control Panel
2. Click on DNS tab
3. Click on "add record" button under example.com
4. Enter xmpp in field "Record"
5. Select type "A"
6. Enter 192.168.1.1 in "IP or Value" textbox
7. Press "Add" button

It was quite simple, insn't it? Well the SRV part is a little bit tricky
1. Login in to Control Panel
2. Click on DNS tab
3. Click on "add record" button under example.com
4. Enter _xmpp-client._tcp in field "Record"
5. Select type "SRV"
6. Enter xmpp.example.com. in "IP or Value" textbox
7. Enter 0 5 5222 in Priority text field 8. Press "Add" button

9. Repeat above steps for _xmpp-server record




How to replace MySQL with Percona Server on RHEL or CentOS

You can safely replace MySQL with Percona Server without lossing any data. In order to do it, please follow the instructions bellow

1. Install Percona repository

yum install https://www.percona.com/redir/downloads/percona-release/redhat/latest/percona-release-0.1-3.noarch.rpm


2. Remove MySQL packages

yum remove mysql mysql-server mysql-libs


3. Install Percona package Percona-Server-server-56 (or the latest version Percona-Server-server-57)

yum install Percona-Server-server-56


4. Start Percona Server

service mysql start


5. Set Percona Server to auto-start

chkconfig mysql on



Please note that you might also need to update php-mysqlnd package if you are using remi

yum install php-mysqlnd phpmyadmin --enablerepo=remi
mv /etc/httpd/conf.d/phpMyAdmin.conf.rpmsave /etc/httpd/conf.d/phpMyAdmin.conf
service httpd restart





How to replace MySQL with Percona Server Debian or Ubuntu

You can safely replace MySQL with Percona Server without lossing any data. In order to do it, please follow the instructions bellow

1. Import Percona GPG key

apt-key adv --keyserver keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A


2. Add this to /etc/apt/sources.list, replacing VERSION with the name of your distribution:

deb http://repo.percona.com/apt VERSION main
deb-src http://repo.percona.com/apt VERSION main


3. Update the local cache:

apt-get update


4. Install Percona packages. When asked please don't change root password.

apt-get install percona-server-server-5.5 percona-server-client-5.5


5. Set Percona Server to auto-start

update-rc.d mysql defaults





How to redirect HTTP to HTTPS using htaccess

You can automatically redirect visitors to the secured (HTTPS) version of your site to make sure your communications are encrypted by using following .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]





How to redirect subdomain to folder using htaccess

Vesta Control Panel equally treats subdomains and domains and there is no option to change this behaviour. However you still might need to handle subdomains as subdirectories of your main domain. Luckily, it can be easily done with .htaccess

1. Add subdomain.domain.com as alias to domain.com

2. Create following .htaccess file in domain.com/public_html/ directory

RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1


3. Create subdomain directory web/domain.com/public_html/subdomain and put index.html


Actually you can handle wildcard subdomains too. Here is .htaccess for that

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(?!www\.)([^.]+)\.domain\.com$ [NC]
RewriteCond %{REQUEST_URI}::%1 !^/([^/]+).*?::\1
RewriteRule ^(.*)$ /%1/$1 [L]