dmy

Adding A Plesk Event Handler

written by admin 2621 days ago. Last update at 2013-04-02 16:29:26. Categories plesk. Tags .

Plesk allows you to have a customized event handler. This is a rather useful feature cause it allows you to customize the way Plesk behaves. Take the meanwhile famous vhost_ssl.conf bug. Although documented in the manual, Plesk will not recognize an additional configuration file for an SSL/TLS port in a subdomain. Solutions have been proposed to manually change vhost.conf. That’s a forbidden fruit however, cause all it needs is a websrvmng --reconfigure-all to eliminate your changes. But as mentioned, just install a event handler which is triggered when a subdomain is created or updated. Such an event handler can be just a plain shell script.

However, when I tried to install such an event handler beast via Plesk | Server | Event Handler | Add New Event Handler I ended up in an error message like Error: Some fields are empty or contain an improper value for which add did not have any explanation. Much, very much later, I discovered that I had copied the path of my script to be executed via copy-n-paste into that Plesk command field. That copy contained whitespace at the end of the command, i.e. something like

/path/to/handler.sh\n

which is enough to make Please grumpy. What’s more, it’s all about whitespace (blanks, tabs, newline etc) at the end of a command while whitespace within the command is accept without any rumble:

echo > /dev/null

That works fine.

Summary:

When entering an event handler command, make sure that there is no whitespace at the end of the command.

dmy

Plesk

written by admin 2634 days ago. Last update at 2013-04-02 16:29:26. Categories apache httpd, plesk. Tags , .

Plesk is kind of freaky creature. Working with it can be a frustrating experience. Not when working with the graphical web interface. Used in that way, it’s easy to create/modify/remove sub-domains and other important tasks. However, the guys from Paralles do not expect apache to server something else than static pages. How else can it be explained, that touching a vhost.conf file is something that is described in appendix A, Advanced Features, in the Plesk manual?

So just assume that you have create a new subdomain and you want to make your CSS files available via /css instead of going via some hardwired domain URL. So all you want to have is an alias like

Alias /css "/path/to/my/css/folder"

Ok, but where to enter? When you look at the folder structure and files created by Plesk it is by no means clear what to do. But hey, what are manuals good for anyway? What you discover is that Plesk created a folder like

  /path/to/domain/subdomains/subdomain/conf

for your subdomain. The folder is empty. It would be really great if Plesk would in addition create a README file in that folder. That file would then state something like this:

To configure your subdomain, add herein a file name vhost.conf. Put any Apache configurations in this file you like but be aware that this file is being included in a virtual host definition.

Once you have have added vhost.conf, please reconfigure this subdomain so that your file is taken into account. You do this by

 $ /usr/local/psa/admin/sbin/websrvmng --reconfigure-all

You need to do this only once, because this command does nothing more than insert a Include statement in /path/to/domain/conf/http.include. But refrain from do it manually because websrvmng will rewrite that file from scratch on the next run.

Oh, and btw notice that regardless of what our manual says you can only have a vhost.conf in a subdomain’s conf folder. Any vhost_ssl.conf therein is not taken into account.

Good luck and have a nice day.

Unfortunately, that README file is missing. Unfortunately.