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!

cgi problem

Status
Not open for further replies.

ThinkGeekness

Technical User
Jan 20, 2003
55
0
0
US
I am now trying to get cgi to work with Apache 1.3 (on RHL 7.3) and here is what I have done so far:

ScriptAlias /cgi-bin/ "/home/httpd/domain/cgi-bin"

<Directory &quot;/home/httpd/domain/cgi-bin&quot;>
AllowOverride None
Options None
Order allow, deny
Allow from All
</Directory>

AddHandeler cgi-script .cgi .pl

And I have also done chmod 755 cgi-bin to the cgi-bin folder.

The error message that I get when I go to is:

Forbidden
You don't have permission to access /cgi-bin/ on this server.

And if I go to I get a 404 error.

Do I have to have a specific user and group? Right now for Apache, I have nobody for the user and group and I have that also for the cgi-bin folder.

If this helps, I logged on as root on my Apache server and went to:


and I also get the Forbidden error.

Any suggestions?

Thanks
 
Something to add:

I spelt AddHandler right in httpd.conf, just not in the last post.

I have made a new cgi-bin folder (called cgi) and set the ScriptAlias, permission to 755, and the Document (in apache) and I get the forbidden error.

Also, even if I dont put anything in the cgi-bin folder, I still get the forbidden message, not an index of page.
 
The default user and group is 'apache' for RH 7.3 version apache. If your changed it to 'nobody', you may want to be sure there is a user and group 'nobody' on your system.
 
Thanks for the suggestion, I just changed the user and group in the httpd.conf file to 'apache' and I changed it for the folder also, but I am still getting the Forbidden error.

Thanks
 
I think that I am getting somewhere. Now if I go to domain.com/cgi-bin I get a 404 error, not what I expected, but its an improvement. I moved

<Directory/home/httpd/domain/cgi-bin>

outside of the

<IfModule mod_alias.c>

I have files in the folder, but I am getting a 404 error. How can I correct this now? If I go to I also get a 404 error.

Thanks
 
I just got the Forbidden error message again. Could you take a look at this and see if anything looks wrong? This is what I have for my http.conf file that deals with CGI:

<IfModule mod_alias.c>

ScriptAlias /cgi-bin/ &quot;/home/httpd/domain/cgi-bin/&quot;

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

</IfModule>

AddHandler cgi-script .cgi .pl

And for the file permissions, I have:

drwxr-xr-x 2 nobody nobody 4096 Feb 24 16:17 cgi-bin

I tried changing the directory, but I got the same Forbidden error.

Thanks for your help.
 
Why is it inside of a <IfModule mod_alias.c> condition? What this will do, is if the condition is true, your cgi-bin will work, if not, it will be ignored. I would suggest putting all your vhost containers at the very bottom of httpd.conf so they are easier to work with. I also see a trailing slash where there should be none. Change this line to:

<Directory &quot;/home/httpd/domain/cgi-bin&quot;>

I'll take another look after I eat dinner. :)

 
Thanks, I just changed the two things, and I have to update this forum on what I have done:

I can now get to the cgi-bin because I REM out the ScriptAlias. I not get a 500 Internal Server Error if I go to I am still trying to figure out how to get so that I can get to the script. Does it matter that I REMed out hte ScriptAlias to get it to work?

Thanks
 
Do you think that it is a problem with a module or the way that I have it set up?

Thanks
 
Maybe it is something that I am doing wrong in the httpd.conf file. The following is of what I have for it that has anything to do directories or CGI. Remember, I have Apache 1.3.26:

ServerRoot &quot;/usr/local/apache&quot;

#Listen 80
#Listen 192.168.0.4:80

#BindAddress *

Port 80

User nobody
Group nobody

ServerAdmin Admin@domain.net

#ServerName domain.net

DocumentRoot &quot;/home/httpd/domain&quot;

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>


<Directory &quot;/home/httpd/domain&quot;>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>


<IfModule mod_dir.c>
DirectoryIndex index.html index.htm
</IfModule>
UseCanonicalName On

<IfModule mod_alias.c>

#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL. So &quot;/icons&quot; isn't aliased in this
# example, only &quot;/icons/&quot;. If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
Alias /icons &quot;/usr/local/apache/icons&quot;

<Directory &quot;/usr/local/apache/icons&quot;>
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

# This Alias will project the on-line documentation tree under /manual/
# even if you change the DocumentRoot. Comment it if you don't want to
# provide access to the on-line documentation.
#
Alias /manual/ &quot;/usr/local/apache/htdocs/manual/&quot;

<Directory &quot;/usr/local/apache/htdocs/manual&quot;>
Options Indexes FollowSymlinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

#
# 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 &quot;/&quot; apply to ScriptAlias directives as to
# Alias.
#
#ScriptAlias /cgi-bin/ &quot;home/httpd/launchweb/cgi-bin/&quot;

</IfModule>

# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
AddType application/x-tar .tgz
# To use CGI scripts:
AddHandler cgi-script .cgi .pl
#AddType text/html .shtml
#AddHandler server-parsed .shtml
#AddHandler send-as-is asis
#AddHandler imap-file map
#AddHandler type-map var

</IfModule>
# End of document types.


#<Location /cgi-bin/phf*>
# Deny from all
# ErrorDocument 403 #</Location>

NameVirtualHost *

<Directory &quot;/home/httpd/domainvh&quot;>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
DirectoryIndex index.html index.htm
</Directory>

<VirtualHost *>
UseCanonicalName Off
</VirtualHost>

<VirtualHost *>
UseCanonicalName Off
ServerName domainvh.com
DocumentRoot &quot;/home/httpd/domainvh&quot;
ServerAlias </VirtualHost>

<Directory &quot;/home/httpd/domain/cgi-bin&quot;>
AllowOverride None
Options +ExecCGI
Order allow,deny
Allow from all
AddHandler cgi-script .cgi .pl
</Directory>

Sorry for it being so long, hopefully this helps. I now know that I have the correct modules installed, if you want me to post the module list, I can.

Thanks
 
If this helps any, if I take out the AddHandler cgi-script .cgi .pl command it works (which I dont know why it wouldnt, it would treat it like a regular file.) But as expected, when I went to try the script, I got a 405 Method Not Allowed error.

I dont know what else I can try... Any suggestions?

Thanks
 
Nevermind, after all of this, it turned out to be the scripts, thanks anyways.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top