1

I'd like to show a custom page for ALL suspended domains in my Plesk instead of showing just a generic "Service Temporarily Unavailable" 503 error page.

I've seen this can be done in a domain per domain basis, but how can I do it so ALL domains in my Plesk (even future domains I will create) get the same custom page in case they are suspended?

4
  • What is a suspended domain? Commented Jun 30, 2020 at 22:49
  • A suspended domain is a domain which has been disabled in your Plesk panel (by clicking on the checkbox near a domain in the Subscriptions section, then clicking on the "Change status" button and then on "Suspend").
    – OMA
    Commented Jul 2, 2020 at 13:11
  • For example, a customer who's no longer paying their bill? Commented Jul 2, 2020 at 13:21
  • 1
    Yes, that's the idea. The stock error message just says "Service Temporarily Unavailable", which looks like a server problem or downtime, which can make your service look bad, when in reality the problem is a customer didn't pay. So a custom error message saying "your service was interrupted because X, Y or Z, please contact us" with a link to a contact form, is way better than a generic server error. Sometimes customers don't even know the service wasn't paid because accounting is another department, and they write us angry about the service not working. These custom pages solve that.
    – OMA
    Commented Jul 2, 2020 at 13:45

1 Answer 1

2

I've found the quickest way to do it, so I'm sharing it here.

First, upload the custom HTML page somewhere in your server or any other server where it can be downloaded from (it doesn't matter where the file is uploaded as long as it's accessible from your Plesk server using wget).

Then, connect to the server with the Plesk installation as root via SSH and enter the following commands to replace the custom page for all future Plesk sites:

cd /var/www/vhosts/.skel/0/error_docs/   
mv maintenance.html maintenance.old
wget https://someserver/maintenance.html

By doing this, the new custom page will be applied to all new domains created in the Plesk panel from now on, but we still have to modify all existing domains as well. To have the new custom page copied to all existing domains in the server you will have to run some extra commands.

Please note that this will overwrite the error pages in ALL of your domains. If all of your domains have the same exact error messages and you think you don't need a backup, you can skip the second line. Otherwise, paste everything into the command line (be careful with the long lines and copy the whole thing).

If you want to run all lines, including the second, which creates backup directories, you can copy and paste all four lines in one go. The backup directories will be called "error_docs_backup" and will be created inside each of the domain directories.

plesk bin subscription -l > subscriptions.txt
while read i; do mkdir -p /var/www/vhosts/$i/error_docs_backup/; chown $(stat -c %U /var/www/vhosts/$i/):psacln /var/www/vhosts/$i/error_docs_backup; cp -a /var/www/vhosts/$i/error_docs/*.html /var/www/vhosts/$i/error_docs_backup/; done < subscriptions.txt
while read i; do \cp /var/www/vhosts/.skel/0/error_docs/*.html /var/www/vhosts/$i/error_docs; chown -R $(stat -c %U /var/www/vhosts/$i/):psacln /var/www/vhosts/$i/error_docs; done < subscriptions.txt
rm -f subscriptions.txt

That's it! No server reboot is needed. The new custom page (or pages, if you modified more than one) will be available in all domains.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.