• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question Perl on Debian

Bod

New Pleskian
Server operating system version
Debian 12
Plesk version and microupdate number
Version 18.0.59 Update #2
I'm new to Plesk, having only installed Obsidian Version 18.0.59 yesterday on a Debian 12 VPS. We are moving from shared hosting, which we have outgrown.

Many of our web pages are dynamically generated with Perl. This does not just run in the cgi-bin but sits in many directories as the default file. However, we are having great difficulty executing these scripts. I've set up a staging area where we will move each site to before copying it to the final location and then moving the DNS. The first site to move is purely static and is now up and running. But as soon as I try to run a Perl script on the next site, I run into trouble.

I've put a very simple Perl script at /var/www/vhosts/example.com/httpdocs/index.pl

Using SSH I have checked that the script works properly outside of a web server environment - it does :)

But...when I access it in a browser, I see the Perl code. So I've put the following in the site's Apache HTTPS handler
Code:
<Directory /var/www/vhosts/example.com/httpdocs>
<Files ~ (\.pl$)>
SetHandler cgi-script
Options ExecCGI
allow from all
</Files>
</Directory>
I think this automagically goes into the vhost_ssl.conf file.
But this causes a 500 Error.

I've checked cgid is on in 'Apache Web Server Settings'

What else do I need to do to get Perl scripts to execute but still allowing HTML pages to display statically?
What should I check next?
 
You can check if your config is applied by looking into /var/www/vhosts/system/example.conf/conf/vhost_ssl.conf.
Error 500 may be caused by incorrect access rights, check /var/log/apache2/suexec.log for any errors after accessing index.pl. The file to be executed must be owned by <your_domain_user>:psacln.
Also, there may be errors in /var/www/vhosts/system/example.com/logs/error_log.
 
  • Like
Reactions: Bod
You can check if your config is applied by looking into /var/www/vhosts/system/example.conf/conf/vhost_ssl.conf.
Error 500 may be caused by incorrect access rights, check /var/log/apache2/suexec.log for any errors after accessing index.pl. The file to be executed must be owned by <your_domain_user>:psacln.
Also, there may be errors in /var/www/vhosts/system/example.com/logs/error_log.
Thank you.

As you rightly suggested, the problem was caused by a permission error.

Is there somewhere I can put the Apache directive so it applies to all sites under /var/www/vhosts/ instead of having to add it to every domain?
 
I think I've solved it...by changing the default directive in /etc/apache2/apache2.conf to:

Code:
<Directory /var/www/>
    <Files ~ (\.pl$)>
        SetHandler cgi-script
        Options ExecCGI
        allow from all
    </Files>
    AddHandler cgi-script .pl
    Options ExecCGI Indexes FollowSymLinks SymLinksIfOwnerMatch
    AllowOverride All
    Require all granted
</Directory>
 
If you want to set it up for all domains, you can use configuration templates, namely the domainVirtualHost.php one.
Enabling CGI all over /var/www may be not secure. You should be 100% sure that a malicious user can't upload a file there.

Also, modifying /etc/apache2/apache2.conf is not optimal, because it may create a conflict on Apache upgrade. It's better to put your custom global config into /etc/apache2/conf-available and then enable it by a2enconf (a2disconf to disable).
 
  • Like
Reactions: Bod
Back
Top