Author Topic: How to run perl cgi outside cgi-bin folder ?  (Read 3102 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
How to run perl cgi outside cgi-bin folder ?
« on: October 18, 2021, 08:08:50 PM »
/usr/local/apache/conf.d/mod_cgid.conf

Code: [Select]
LoadModule suexec_module modules/mod_suexec.so
LoadModule cgid_module modules/mod_cgid.so

<IfModule cgid_module>
<Directory /home/*/public_html/cgi-bin/>
Options ExecCGI SymLinksifOwnerMatch
SetHandler cgi-script
AddHandler cgi-script .cgi .pl .py
Require all granted
AllowOverride All
</Directory>
</IfModule>

Work very well. But when I changed to
Code: [Select]
<Directory /home/*/public_html/>It crash all accesses even-though .htm
« Last Edit: October 18, 2021, 08:16:46 PM by sappurit »

Offline
*
Re: How to run perl cgi outside cgi-bin folder ?
« Reply #1 on: October 19, 2021, 03:37:07 PM »
Solved now! with the following code:

Code: [Select]
LoadModule suexec_module modules/mod_suexec.so
LoadModule cgid_module modules/mod_cgid.so

<IfModule cgid_module>
<Directory "/home/*/public_html/">
Options +ExecCGI +Includes +SymLinksIfOwnerMatch
AddHandler cgi-script .cgi .pl
Require all granted
AllowOverride All
</Directory>
</IfModule>


I saw in errorlog and search about:
Code: [Select]
[cgid:error] [pid 41348:tid 139847045981952] [client 49.237.xx.xxx:24894] End of script output before headers: index.cgi

and found the same problem at
Code: [Select]
https://stackoverflow.com/questions/28265735/apache-cgi-in-user-directory-end-of-script-output-before-headers
I checked the user public_html folder and found out that group was set to nobody.
Then I chgrp to the user group and chmod to 755.
Then all working.
« Last Edit: October 19, 2021, 03:39:18 PM by sappurit »