I'm running Apache2 on ubuntu 16.04,just installed it all fresh, and trying to run a CGI script on my site! I'm aware apache needs to be configured to run it. I've put my cgi-bin directory in var/www with:

sudo mkdir -p /var/www/cgi-bin/

then ran this (although not sure why!):

sudo chown $USER:www-data /var/www/cgi-bin/

Then added these to my apache.conf file:

ScriptAlias  /cgi-bin/var/www/cgi-bin/ 

< Directory /var/www/cgi-bin/ > 
    Options ExecCGI <br>
    AddHandler cgi-script cgi pl 
< /Directory >

Essentially when I open my site, some javascript runs jqueries ajax with the CGI script as an argument, and well it's just not running! :(

Sorry for awful formatting of post etc. it's my first, and if anyone needs any other info/attachments please let me know, this is for a big deadline and i'm so close but so far!


ScriptAlias directive is missing a space and a "/". Change to:

ScriptAlias /cgi-bin/ /var/www/cgi-bin/

and remove "<br>" from the Options directive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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