Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I created the following Alias in httpd.conf:

alias /aliasedfolder /some/location/on/the/server/folder
<Location /aliasedfolder>
  AddHandler cgi-script .pl
  Options +FollowSymLinks +ExecCGI
  Order allow,deny
  Allow from all
  AllowOverride None
</Location>

The problem is that i can view images within "aliasedfolder" but i am getting a "file does not exist" error when i run a perl script there, e.g. /aliasedfolder/script.pl.

The physical perl script exist in "/some/location/on/the/server/folder".

I made sure the script has 755 permission.

Below is the contents of the perl script:

#!/usr/bin/perl
use CGI qw/:standard/;
print "Content-type:text/html;\n\n";
print "Hello world";
1;

What seems to be the problem?

share|improve this question
    
Forget about the logfiles (can't delete the comment). –  ott-- Dec 11 '12 at 20:59
    
I see that this has been solved but shouldn't you be using "ScriptAlias" anyway? –  igelkott Feb 26 '13 at 12:49
add comment

3 Answers

After checking the ownership of /some/location/on/the/server/folder, I found out that the owner is the "root" username, whileas I was trying to access the folder through an account (domain name) on Apache that has a different username, e.g. domain.com/aliasedfolder/script.pl

The suexec mechanism is preventing this as a security feature. So, I changed the ownership of the /some/location/on/the/server/folder and the script.pl file inside it from "root" to my account's username and group, and it is working now.

This will prevent other domains pointing to my server from accessing this file (script.pl), as suexec prevents a single file to be shared by multiple domains (which have different usernames).

I can disable the suexec mechanism altogether, but I was advised not to do so due to security concerns.

Thanks for all who tried to help.

share|improve this answer
add comment

What is your documentroot ? And "/some/location/on/the/server/folder" is an absolute or a relative (to documentroot) path ?

share|improve this answer
    
This should be a comment. –  Christian Dec 12 '12 at 17:22
add comment

Have you tried using a

<Directory "/some/location/on/the/server/folder" >
    AddHandler cgi-script .pl
    ....
    AllowOverride None
</Directory>

Also are you running any security measures, such as suExec or SELinux, if you are there are additional ownership and extended attributes tweaks required for your scripts.

share|improve this answer
    
Tried it, but it didn't work. –  Haydar Al-Rikabi Dec 11 '12 at 21:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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