Reese Knowledgebase

How To recreate Apache's configuration files via command line for Parallels Plesk

View Kristian Reese's profile on LinkedIn

If you like this article, please +1 or Recommend via FB with the provided buttons above:

Article ID: 65
by: Reese K.
Posted: 28 Sep, 2012
Last updated: 28 Sep, 2012
Views: 2837

Recreate Apache's Configuration Files

When some of my VPS customers are hacked, it's a lot easier to regenerate Apache's configuration files post reimage via command line than trying to remember which of these files need to be restored, espcially when dealing with an environment that uses Plesk 8, 9, and 10.

Typically, after recreating the container and installing any related vz pkgs, I will stop mysql, make a tar backup of /var/lib/mysql, then rsync all mysql content from a known good, or unhacked backup.

Next, I rsync all /var/www/vhost stuff over, then copy /etc/{passwd,shadow,group,php.ini} (if shadow is there) and run pwconv on the source.

Next, named.conf needs to be repopulated with records from the psa database, so I'll create a file named that I got from parallels kb


ADMIN_PASS=`cat /etc/psa/.psa.shadow`
MYSQL_BIN_D=`grep MYSQL_BIN_D /etc/psa/psa.conf | awk '{print $2}'`
PRODUCT_ROOT_D=`grep PRODUCT_ROOT_D /etc/psa/psa.conf | awk '{print $2}'`
mysql="${MYSQL_BIN_D}/mysql -N -uadmin -p${ADMIN_PASS} psa"

query="select name from domains;"
domains=`echo $query | $mysql `

for i in ${domains}; do
    echo "echo $i"
    $PRODUCT_ROOT_D/admin/sbin/dnsmng update $i

Once you have applied these changes, you should recreate Apache’s configuration files and restart the Apache service using the following command in the shell

This command is for PP 10.x:
~# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

For versions 9.x and older use this command instead:
~# /usr/local/psa/admin/sbin/websrvmng -a -v

apache will likely fail to restart, complaining about a missing certificate.  Either rsync over /usr/local/psa/var/certificates/<cert that it bitches about> and run command again, or edit the file referenced in the error with the cert created from the reimage in /usr/local/psa/var/certificates/ and run the command again.

This article was:   Helpful | Not Helpful
Prev   Next
failed to download drweb32.lst     get_admin_password failed (Resetting admin password)