How to update error documents (/error_docs/) for all domains?

Created:

2017-05-11 11:50:43 UTC

Modified:

2017-08-08 13:12:09 UTC

0

Was this article helpful?


Have more questions?

Submit a request

How to update error documents (/error_docs/) for all domains?

Applicable to:

  • Plesk for Linux

Question

Is there a way to update error documents server-wide?

Answer

1. Change required default error documents in /var/www/vhosts/.skel/0/error_docs/

2. Create a script, for example errordocs.sh that will copy this documents to all /error_docs/ directories of all main domains of all subscriptions.

 ~]# cat errordocs.sh
#!/bin/bash
for i in `plesk db -Ne "select name from domains where webspace_id = 0;"`
do
   yes | cp -a /var/www/vhosts/.skel/0/error_docs/ /var/www/vhosts/$i/
done

3. Execute the script:

~]# chmod +x errordocs.sh
~]# ./errordocs.sh

4. Create a script, for example perm.sh that will set correct permissions on all copied documents:

~]# cat perm.sh
#!/bin/bash
VHOST_DIR="/var/www/vhosts"
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin psa -sN -e"SELECT d.name, h.www_root, s.login FROM domains d, hosting h, sys_users s WHERE s.id=h.sys_user_id AND h.dom_id=d.id AND d.webspace_id=0" | while read domain www user; do
 chown -R $user.psacln $VHOST_DIR/$domain
done

5. Execute the script:

~]# chmod +x perm.sh
~]# ./perm.sh


Scripts perm.sh and errordocs.sh are available in the attachment.

Attachments:

Have more questions? Submit a request
Please sign in to leave a comment.