LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2005, 10:46 AM   #1
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,169

Rep: Reputation: 51
HTTPD (Apache) config oddity


I have the following settings in HTTPD configuration file:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/cgi-bin/"

# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/cgi-bin/">

However when I call a CGI routine called "j1" that is in /var/www/cgi-bin/ from an html document
<form method='post' action='http://192.168.1.13/j1' onSubmit='this.Result.value=top.frames[0].result;'>

does not work, but the following does work

<form method='post' action='http://192.168.1.13/cgi-bin/j1' onSubmit='this.Result.value=top.frames[0].result;'>

Just to make sure the config file is applied, I restarted HTTPD with
/usr/sbin/apachectl restart
but it makes no difference.

According to the manual, I shouldn't have to include "cgi-bin/" in the link .
Has anyone any idea or suggestion?

Thank you very much for your help.
 
Old 07-10-2005, 11:40 AM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 153Reputation: 153
It's likely you have a ScriptAlias directive pointing to /var/www/cgi-bin/ and that you haven't enabled cgi scripts to be executed in the <Directory "/var/www/cgi-bin/"> clause. Both / and /cgi-bin will point to the same place but only /cgi-bin will work because it is configured to execute cgi scripts
 
Old 07-10-2005, 11:37 PM   #3
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,169

Original Poster
Rep: Reputation: 51
Thanks to phil.d.g, you are correct. Should I do anything to clean up the file?
Here is the relevant code.
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

#
# "/var/www/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
 
Old 07-11-2005, 04:46 AM   #4
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 153Reputation: 153
Its been a long time since I've played with cgi scripts, I use php now, but you need to replace this line:
Code:
Options None
with
Code:
Options +ExecCGI +Includes
. And make sure you have the lines
Code:
 AddHandler cgi-script cgi pl
AddType text/html shtml
AddHandler server-parsed shtml
somewhere within the global configuration. This will allow you to run cgi scripts directly from / and also include cgi scripts in .shtml docs. You can then remove
Code:
ScriptAlias /cgi-bin /var/www/cgi-bin
hold on a minute, the above needs to be done to the <directory> clause quoted in you first post, the section posted in post #3 can be all commented out

Ah, here we go:
From here you can find what you need, I know its for .htaccess but its applicable to the <Directory> clause as well.

EDIT: PS this probably would have received far more responses if you had put it in 'Linux - Software' or 'Linux - General'

Last edited by phil.d.g; 07-11-2005 at 06:05 AM.
 
Old 07-11-2005, 08:59 AM   #5
rblampain
Senior Member
 
Registered: Aug 2004
Location: Western Australia
Distribution: Debian 9.2
Posts: 1,169

Original Poster
Rep: Reputation: 51
Thank you again, very good.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pls pls pls help me ! i'm tired with httpd config on fedora apache 2.0.48 AngelOfTheDamn Fedora 0 01-24-2004 06:12 PM
apache httpd.config question fibbi Linux - Software 4 10-18-2003 11:07 AM
Easy httpd config: Config for ~user lsgko Linux - Software 0 08-22-2003 12:55 AM
Easy httpd config: Config for ~user lsgko Linux - Newbie 2 08-18-2003 06:34 PM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 11:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:40 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration