I may catch a lot of flack as perhaps I have made a bunch of mistakes … but I set this up all by hand on a RedHat 8 server back in 2021 after the initial Virtualmin virtual server creation – I did:
created a unique subdirectory
/var/www/web_ill/cgi-bin2/
incorporating the linux userid web_ill
along with the unique name cgi-bin2
This subdirectory holds the perl files, all with a .CGI
suffix (these forms were migrated As-IS from the previous webserver, the .CGI
suffix might not be a requirement)
Both the web_ill and cgi-bin2 directories are owned by the user web_ill in case that user wishes to edit the files located there.
then added/adjusted httpd.conf in the proper virtualserver stanza to have:
ScriptAlias /cgi-bin2/ /var/www/web_ill/cgi-bin2/
and
<Directory /var/www/web_ill/cgi-bin2>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler cgi-script .pl
Require all granted
</Directory>
for our environment, we are processing a form — an simplified example (not tested):
<html>
<p>
If information needs to be updated on the page, please fill out the form below.
<form method="post" action="/cgi-bin2/ILL_Update_Form.cgi">
<p>
Library Name: <input name="libraryname" type="text" style="width:400px;"/>
<p>
Contact Individual: <input name="contact" type="text" style="width:400px;"/>
<p>
Phone: <input name="phone" type="text" style="width:140px;"/>
<p>
E-mail: <input name="email" type="text" style="width:350px"/>
<p>
<br>
<p>
<input value="Submit" type="submit"/>
<input value="Reset" type="reset"/>
</form>
</html>
when we migrated this from a very old server, we just didn’t have the time to rewrite it in php or some other language or framework
Our perl scripts eventually send out an email message.
And all our perl files have as their first line:
#!/usr/bin/perl -wT
While its been working OK as far as we know since we implemented it, I welcome any suggestions on how to make it better.