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.

Goal: Have multiple domains share a set of cgi(perl) scripts

Environment: Apache 2.0 on a dedicated Cent OS server. (Apache configuration files generated by cPanel)

I have dozens of domains on the dedicated server. The domains set up by cPanel under VirtualHost section. I have almost no knowledge of Apache. Most of what I do is taken care of by cPanel.

I would like to put a set of scripts under one directory (perhaps under / or /opt ) and for each of the domains, under the individual cgi-bin, I would like to create a symbolic link to this common directory. This way I am hoping to avoid having to keep a copy of scripts for every domain.

Since Apache config files are generated by cPanel, I would not like to manually make changes to those. Beside, I could mess things up. I see that cPanel recommends use of include files rather than changing the httpd.conf

Perhaps I need to have the following of symbolic links enabled in the cgi-bin directory and allow the web server user execute the scripts not owned by it.

May be I am making things more complicated than they are. I would be glad to use any other means to achieve my goal. Thanks in advance for your help.

*I asked this on stackoverflow and some one suggested that I could ask this on serverfault.

share|improve this question
add comment

1 Answer

write a file that defines your cgi - save it as /opt/cgi.conf

ScriptAlias /cgi-bin/ "/opt/bin"
<Directory "/opt/bin">
   AllowOverride None
   Options None
   Order allow,deny
   Allow from all
</Directory>

from cpanel include it as

Include /opt/cgi.conf

place your scripts into /opt/bin and make sure they are executable.

share|improve this answer
    
I do not think I understand this right. I have more than a dozen domains. All the domains access the cgi-scripts similar to the following: domain.xxx/cgi-bin/mydir/script.pl I had thought of putting a directory /opt/mydir and the mydir under cgi-bin would be a link to /opt/mydir. If I put the scripts into like you say /opt/bin, what would be URL when I access the script from each individual domain. –  rpat Jan 3 '11 at 5:31
    
find where is you directory that contains that cgi scripts. then substitute the /opt/bin/ with that directory. –  silviud Jan 3 '11 at 14:33
    
Let me play around to see if I this solution works for my situation. Thanks –  rpat Jan 5 '11 at 5:50
    
What you have suggested here should work. However, my apache config files are cPanel generated, the virtual hosts have suExec. This means the web server user and the owner of the common directory will be different. Unfortunately, I do not have the time to research this more at the moment. I will need to come back to it later. Would you know if this will work if the web server user is different from the file owner with suExec set? Thanks for your time and help. –  rpat Jan 6 '11 at 1:50
    
as long as you can read those virtual hosts config files you should be fine, but I don't have much experience with cpanel - let me know –  silviud Jan 6 '11 at 15:06
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.