Forum: 

CGI as document root

Will's picture

Hi Guys!

I'm using Turnkey LAMP version 14, I think. I'm having to add functionality to an academic perl site, so I'm trying to create a test box with Turnkey LAMP. When I used Turnkey LAMP for a php test site, it WAS turnkey. This is NOT.

The site I'm trying to add functionality to is written completely in Perl and cgi. As in perl pages create ALL the HTML. I NEED to be able to have a perl/cgi script as document root. I've looked at the existing questions, and they seem to be about calling cgi-bin scripts from other types of pages. I want apache to call perl/cgi scripts as the default. I want to point my browser at the ip of the box and have test.cgi displayed to start with. What I've tried so far is:

cp /var/www/test.cgi /var/www/test.cgi

vi 000-default.conf

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/cgi-bin
</VirtualHost>

<VirtualHost *:443>
        SSLEngine on
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/cgi-bin
</VirtualHost>

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

<Directory /var/www/cgi-bin>
        Options Indexes FollowSymLinks MultiViews
        Order allow,deny
        allow from all
        AllowOverride None
        Options +ExecCGI -Multiviews +SymLinksIfOwnerMatch
</Directory>

and service apache2 restart

What else do I need to do to make test.cgi my document root so that it is not http 404 when i point my browser at my.ip.1.2/test.cgi or my.ip.1.2

 

Thanks

 

Will's picture

Changed 000-default.conf from

DocumentRoot /var/www/cgi-bin

to

DocumentRoot /var/www/

and changed /var/www/test.cgi to /var/www/index.cgi

Got progress!

The whole file is displayed. Apache is not executing, even though index.cgi has permissions:

-rwx-xr--x

What gives?

does 000-default.conf == httpd.conf? If so, why the name change?

Will's picture

my.ip.1.2/cgi-bin/test.cgi

results in a 404 error?

Jeremy Davis's picture

I've been away...

Anyway, this is a known bug in v14.0 & v14.1 (see someone else's post here). It will be fixed in our next release but in the meantime please note my response on that thread:

I have lodged an issue on our tracker.

[update] Here's the specifics to get the example cgi script working.

That should get the example script working and make it clear what needs to be done to get your scripts running.

Post new comment