LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-27-2002, 12:57 PM   #1
cgchris99
LQ Newbie
 
Registered: Dec 2001
Posts: 12

Rep: Reputation: 0
Question on virtual hosts and CGI-BIN directory


I have multiple virtual hosts running on apache.
I have a cgi script (ennyforms) for doing forms. But they are slightly different with for each website.

Do you create virtual CGI-BIN directories? And keep the main CGI-BIN for global stuff?

my ideas was to create subdirectories for each domain called vcgi-bin.

Any reason I should NOT do this?

Sorry if this is posted in the wrong forum.

Thanks for any help.
 
Old 02-27-2002, 03:09 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
you got the right forum..

i would probably suggest its best to create their own cgi-bin's for each virtual host.
 
Old 02-27-2002, 03:14 PM   #3
cgchris99
LQ Newbie
 
Registered: Dec 2001
Posts: 12

Original Poster
Rep: Reputation: 0
How do I get the system to execute code that is in the main /cgi-bin/ directory (global for all hosts) and also code the is in the virtual hosts cgi-bin directory?

I don't want to move the scripts that are in the main cgi-bin directory to the virtual directory, because I don't want the users to have access to it.

Also, how do I protect the server if they can upload their own cgi scripts?

Thanks
 
Old 02-27-2002, 03:21 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
you may want to read some on this site.. pretty good info with security and cgi on websites. http://www-genome.wi.mit.edu/WWW/faq...urity-faq.html
 
Old 10-09-2002, 12:46 PM   #5
guido
LQ Newbie
 
Registered: Oct 2002
Location: Italy- Rome
Posts: 3

Rep: Reputation: 0
that link is incorrect.. some one know other resource?
Thx!
Guido
 
Old 10-09-2002, 05:01 PM   #6
dewcansam
Member
 
Registered: Nov 2001
Location: Hi Hat KY USA
Distribution: RedHat, Mandrake
Posts: 63

Rep: Reputation: 15
Have you tried apache.org ?

Back to your orginal questions... You can do either or both. I prefer to keep virtual web sites to them-selves.
First, I keep virtual sites in their own configuration file, with the <VirtualHost> tag I can add the <directory> tags. So I get this...

[/etc/httpd/conf/virtual_sites/]$ less www.domain_1.com

NameVirtualHost *
<VirtualHost *>
ServerName www.domain_1.com
DocumentRoot /var/www/virtual_sites/www.domain_1.com/public
ServerAdmin webmaster@[www.domain_1.com
ErrorLog /var/log/httpd/virtual_sites/www.domain_1.com-error.log
CustomLog /var/log/httpd/virtual_sites/www.domain_1.com-access.log combined

ScriptAlias /cgi-bin/ "/var/www/virtual_sites/www.domain_1.com/cgi-bin/"
<Directory "/var/www/virtual_sites/www.domain_1.com/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

</VirtualHost>
 
Old 10-09-2002, 06:59 PM   #7
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
I do not know if this would work but just an idea for a mod or someone with more experience to reply to.

That said could you make a oddball user like cgiuser or something and do a chown on the cgi-bin and give the cgiuser access instead of the people in charge of the virtual sites? From what I know the user apache is running as (usually the user "nobody") only needs to be able to execute the file so by giving a different user in a different group access to the file and the whole cgi-bin directory it would keep people from uploading or changing the scripts in the cgi-bin directory.

Once again just a thought, I have never tried it but just thought it might work.
 
Old 10-10-2002, 01:00 AM   #8
guido
LQ Newbie
 
Registered: Oct 2002
Location: Italy- Rome
Posts: 3

Rep: Reputation: 0
I'm using mandrake 8.2 and apache 1.3 with cgi-wrappper enabled. So it is not a problem of owner.
In my virtual host congid i added the scriptalias directive, and the +ExecCGI directive, but from the config file posted here looks like i forgot to "allow from all" . I'll try again tomorrow in office
Thx anyway.
Guido
 
Old 10-10-2002, 02:55 AM   #9
dewcansam
Member
 
Registered: Nov 2001
Location: Hi Hat KY USA
Distribution: RedHat, Mandrake
Posts: 63

Rep: Reputation: 15
If the 'Order allow,deny' is not specified then the directive defaults to deny,allow. and it appears (not exactly sure) that Deny defaults to all. So if it's not specified it looks like this...

Order deny,allow
Deny from all

the premissions on the actuall directory should at least be world read and execute. d------r-x
 
Old 10-11-2002, 11:57 AM   #10
guido
LQ Newbie
 
Registered: Oct 2002
Location: Italy- Rome
Posts: 3

Rep: Reputation: 0
well i figured it ....
CGI-wrapper on mandrake 8.2 is complied without the option for user's homedir..
So even if u specify scriptalias directive, it will not work. suexec will stop execution reporting that script is not in docroot...
it wants scripts in /var/www/cgi-bin/
a symlink in /var/www/cgi-bin/ pointing at user dir doesnt work either .
hope this can help.
Guido
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cgi under virtual hosts vbsaltydog Red Hat 4 11-28-2005 09:16 PM
vqadmin help please (cgi and virtual hosts) nixinbarrie Linux - Software 1 07-18-2005 09:26 PM
virtual hosts and excuting CGI matttail Linux - Newbie 2 08-30-2004 10:04 AM
CGI-BINS for virtual hosts in apache? Trixer Linux - Software 0 06-13-2003 09:15 PM
How-to setup on Apache some Multiple Namebased Virtual Websites with cgi-bin FunkFlex Linux - Newbie 0 02-08-2002 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration