Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Give each domain it's own cgi-bin

Status
Not open for further replies.

optimised

Technical User
Jun 21, 2001
96
0
0
US
Hello,

I currently have mydomain able to run cgi-scripts which are stored in the subdirectory of home/mydomain/cgi-bin. I would like mynewdomain to use a modified version of this script from it's own cgi-bin. So I guess what I am asking how do I give mynewdomain it's own cgi-bin. Can I define a new ScriptAlias globaly? -- thanks

path to domain:
/home/mydomain
|cgi-bin
|www

//HTTPD SECTIONS
NameVirtualHost xxx.xxx.xxx.xx

#ScriptAlias /cgi-bin/ "/var/# "/var/ should be changed to your ScriptAliased
# CGI directory exists, if you have that configured.
#
#<Directory &quot;/var/# AllowOverride None
# Options ExecCGI
# Order allow,deny
# Allow from all
#</Directory>

ScriptAlias /cgi-bin/ /home/mydomain/cgi-bin/

<Directory &quot;/home/mydomain/Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory &quot;/home/mydomain/cgi-bin&quot;>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# Virtual hosts
# Virtual host mydomain.com
<VirtualHost xxx.xxx.xxx.xx>
DocumentRoot /home/mydomain/www/
ServerAdmin me@mydomain.com
ServerName ServerSignature email
</VirtualHost>

<VirtualHost xxx.xxx.xxx.xx>
DocumentRoot /home/mynewdomain/www/
ServerAdmin me@mynewdomain.com
ServerName ServerSignature email
</VirtualHost>

# Directories...

<Directory &quot;/var/ Options ExecCGI
AllowOverride None
Allow from from all
Order allow,deny
</Directory>
 
Hi optimized,
Anything out side the VirtualHost containers are considered global. You can only define a global directive once. However each VirtualHost container can have its own set of directives that will override any global definitions. Just put the new SciptAlias directive and it directory container inside the VirtualHost container. Any directive not defined within a VirtualHost container will default to the global directive.

 
Hi RhythmAce,
Thanks for advice. Do I need to define directories paths done below for mynewdomain? Or do I just need to simply add the ScriptAlias line. I Would like to keep my httpd file as clean and short as possible.. Thanks

<VirtualHost xxx.xxx.xxx.xx>
DocumentRoot /home/mynewdomain/www/
ServerAdmin me@mynewdomain.com
ServerName ServerSignature email
ScriptAlias /cgi-bin/ /home/mynewdomain/cgi-bin/

<Directory &quot;/home/mynewdomain/Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<Directory &quot;/home/mynewdomain/cgi-bin&quot;>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

</VirtualHost>
 
Yes, any directories that you want apache to have access to must be defined. However, let's say you have sub-directories under your cgi-bin. They will have the same properties as cgi-bin unless you define a container for them within your cgi-bin container. I think I understand your question now. If you are asking if you just have to define directives in your Vhost container to make them global to that vhost, the answer is yes. Whatever you put in there will apply to everything under /home/mynewdomain. If you are going to use the same directives for each directory as in the sample above, then you don't even have to have containers for them. I think the only thing you really need is in the virtualhost container is DocumentRoot and ServerName but then again, I've never tried it. :eek:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top