Link to home
Start Free TrialLog in
Avatar of nike_golf
nike_golfFlag for Afghanistan

asked on

Running Perl script on Ubuntu Gutsy using Webmin..

I'm currently running Gutsy with Webmin and virtual  hosting is in working order at the moment with a number of virtual sites running.
 
I'm trying to get a Perl script to work on one of the virtual hosts and I'm just not having any luck, so I'm hoping someone can  help me out.
 
What I want to do is allow each virtual host to be able to have their own /cgi-bin directory for their scripts, sounds simple but implementation is a bit elusive for me, hopefully someone can  help.

NG,
ASKER CERTIFIED SOLUTION
Avatar of almilyo
almilyo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nike_golf

ASKER

I'm still cutting my teeth on WebMin and Apache how exactly would I implement a scriptalias? what about permissions and the like how would those be handled?

Thanks.

Avatar of almilyo
almilyo

Sorry, I didn't read properly that you were using webmin.

I've had a  quick look and *think* this will implement what you want, but backup all your configuration first (or wait for someone better at webmin that I am) - instructions taken from webmin 1.310.

1> On the appache server configuration page, click the virtual server you want to configure
2> On that virtual server page click the 'cgi programs' icon
3> for 'CGI Directory Aliases' type the path in the browser in the first box ie '/cgi-bin' and the path on the server, eg '/path/to/cgi/files/onserver' in the second.
4> Hit save, hit apply

You need to make sure the user running apache has execute permissions on the files, which you can do from the shell by making apache own the files 'chown apache /path/to/files/* -R' then setting them to mode 700: 'chmod 700 /path/to/files/* -R'

I'm assuming the directives for each virtual server should get modified if done correctly with the following or some derivative thereof?

 Alias /cgi-bin/ /web/cgi-bin/
<Location /cgi-bin >
SetHandler cgi-script
Options +ExecCGI
</Location>

"You need to make sure the user running apache has execute permissions on the files, which you can do from the shell by making apache own the files 'chown apache /path/to/files/* -R' then setting them to mode 700: 'chmod 700 /path/to/files/* -R'"

Would Webmin create the cgi-bin folder when running the 'CGI Directory Aliases' and supplying the folder for the scripts?

Thanks.

NG,
"Would Webmin create the cgi-bin folder when running the 'CGI Directory Aliases' and supplying the folder for the scripts?"

No.  Webmin is just an easier way of editing Apache's configuration files, something you can do just as effectively with a simple text editor, but without the assistance the Webmin interface provides.  The files you are editing just tell Apache what to do, if you point Apache at a directory to use as its script directory, you'll have to make that directory yourself, and with the proper permissions and ownership.
Well, even though I did need to run a Script Alias I also had to modify the apache.conf file to permit .pl scripts as I followed the instructions here (http://www.thesitewizard.com/archive/addcgitoapache.shtml).

The scripting seems to be working since I'm able to execute a script within the cgi folder, thanks for the help.

NG,