Monthly Archives: June 2013

How to repair mail server configuration in Plesk?

Use mchk utility to repair/rebuild mail server configuration and restore settings for all mailboxes created in Parallels Plesk Panel.

Plesk for Linux:

~# /usr/local/psa/admin/sbin/mchk –help
Restore settings for all mailboxes.
Usage: /usr/local/psa/admin/sbin/mchk [OPTION]

OPTIONS:
–without-spam restore all settings except for SpamAssassin configuration
–with-spam restore all settings
–spam-only restore only SpamAssassin settings

~# /usr/local/psa/admin/sbin/mchk –with-spam


Plesk for Windows:

Warning! Only settings that were applied to mailboxes through Parallels Plesk Panel interface or command-line utilities will be restored by mchk. Any custom configuration options, applied by other means (e.g. through mail server’s configuration console), will be lost.

C:>“%plesk_bin%mchk” –help
usage: mchk [options] …

–help
–all [–fix=all|local]
–domain –domain-name= [–fix=local]
–domains –domain-names=| [–via-file] [–fix=local]
–all-domains [–fix=local]
–global-settings

Usage example:

C:>”%plesk_bin%mchk” –all

How to fix Nginx error “Too many open files”

nginx: [emerg] open() “/var/www/vhosts/webserverpage.com/statistics/logs/webmail_access_log” failed (24: Too many open files)
nginx: configuration file /etc/nginx/nginx.conf test failed
Please resolve the errors in web server configuration templates and generate the file again.

# echo ‘ULIMIT=”-n 4096″‘ >> /etc/sysconfig/nginx
# cp /etc/init.d/nginx /root/nginx.backup
# wget http://kb.parallels.com/Attachments/22839/Attachments/nginx.redhat-centos.patch
# patch /etc/init.d/nginx nginx.redhat-centos.patch

# egrep “root|psaadm” /etc/security/limits.conf
root hard nofile 4096
root soft nofile 4096
psaadm hard nofile 4096
psaadm soft nofile 4096

Add line ulimit -n 32768 at the beginning of script /usr/local/psa/admin/sbin/nginx-config:
#!/usr/bin/env bash
ulimit -n 32768

Restart sw-cp-server and Nginx services:
# /etc/init.d/sw-cp-server restart
# /etc/init.d/nginx restart

Then regenerate web-server configuration:
# /usr/local/psa/admin/sbin/httpdmng –reconfigure-all