logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Apache and perl cgi help needed
Author
ineuw



Joined: 26 Jan 2008
Posts: 4

PostPosted: Sun 27 Jan '08 1:13    Post subject: Apache and perl cgi help needed Reply with quote

I am trying to test the hello.cgi on my home standalone workstation where the OS is XP SP2. I am using Apache 2.2 and installed ActivePerl 5.10.0.1001 and configured Apache accordingly. There are no errors in the Apache error.log after editing the httpd.conf, adding the necessary parameters for perl and restarting Apache.

Apache works fine and it displays the index.html when accessed from localhost, (http://localhost:8080/index.html) or when pointing the browser to my domain and accessing it from the web.

The problem is that when I type http://localhost:8080/hello.cgi into the address bar. I am getting the following message:
---------------------------------------------------------------
403 Forbidden - You don't have permission to access /hello.cgi on this server.
----------------------------------------------------------------
I pasted the contents of the httpd.conf below. The only change I made is masking my domain name.

Any help is greatly appreciated

ThreadsPerChild 250
MaxRequestsPerChild 0

ServerRoot "C:/Program Files/Apache Software Foundation/Apache2.2"

Listen 8080

LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_default_module modules/mod_authz_default.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imagemap_module modules/mod_imagemap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule php5_module "c:/php/php5apache2_2.dll"

AddType application/x-httpd-php .php
PHPIniDir "C:/php"
ServerAdmin abcd@abcdefg.com
ServerName sanfrancisco:8080

DocumentRoot "E:/WebPages/Workshop"

<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Deny from all
Satisfy all
</Directory>

UserDir "E:/WebPages/Workshop"

<Directory "E:/WebPages/Workshop">
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>

<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>

<IfModule dir_module>
DirectoryIndex index.html index.htm index.php index.cgi
</IfModule>

<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>

ErrorLog logs/error.log
LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog logs/access.log common
</IfModule>

<IfModule alias_module>
ScriptAlias /cgi-bin/ "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/"
</IfModule>

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

DefaultType text/plain

<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddHandler cgi-script .cgi .pl
AddHandler server-parsed .html
</IfModule>
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 27 Jan '08 5:09    Post subject: Reply with quote

Where's?

<Directory "C:/Program Files/Apache Software Foundation/Apache2.2">
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>


however .. if hello.cgi is located in
C:/Program Files/Apache Software Foundation/Apache2.2

you will need to add ExecCGI to the Options in the above container
Back to top
ineuw



Joined: 26 Jan 2008
Posts: 4

PostPosted: Sun 27 Jan '08 5:17    Post subject: Apache and perl cgi help needed Reply with quote

Hello glsmith

Thanks for the speedy reply and sorry about the complete post. I do not have the lines you specified. What I have is:

<Directory />
Options FollowSymLinks
AllowOverride None
Order allow,deny
Deny from all
Satisfy all
</Directory>

Could this be the problem?
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 27 Jan '08 12:05    Post subject: Reply with quote

My dyslexia got the better of me .. ignore my last post

my first question should be, what's the error log say?
Back to top
ineuw



Joined: 26 Jan 2008
Posts: 4

PostPosted: Sun 27 Jan '08 18:22    Post subject: Reply with quote

glsmith wrote:
My dyslexia got the better of me .. ignore my last post my first question should be, what's the error log say?


It's nice to connect with a fellow dyslexic. I should have looked closer in the error.log. It says that "Options ExecCGI is off in this directory: E:/WebPages/Workshop/hello.cgi"

My question is: how to enable it and which line of the .conf file do I change?

Thanks again,
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Sun 27 Jan '08 22:21    Post subject: Reply with quote

Yeah, error log is a good thing

Since you are doing cgi/perl stuff, you may want to add the script log as well to the main server config. On a new line under the ErrorLog directive add
ScriptLog logs/script-error.log
This will give you usefull info when/if any scripts fail

Now, for you answer to the immediate problem;

<Directory "E:/WebPages/Workshop">
AllowOverride FileInfo AuthConfig Limit
Options ExecCGI MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec

<Limit GET POST OPTIONS PROPFIND>
Order allow,deny
Allow from all
</Limit>

<LimitExcept GET POST OPTIONS PROPFIND>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>



For the time being you may want to disable UserDir till you read up on just how to use it

#
UserDir "E:/WebPages/Workshop"
Back to top
ineuw



Joined: 26 Jan 2008
Posts: 4

PostPosted: Mon 28 Jan '08 20:11    Post subject: Reply with quote

Hello glsmith,

A profusion of thanks for all your help. Finally, hello.cgi is working as it should and I can continue with development. At this level of knowledge, I am not really sure what I did. In order to get everything working, I may have allowed more than necessary and perhaps opened myself for a web attack? Also, there may be duplicate lines in the .conf file. I am studying the parameters to improve the configuration and if I don't understand something, I will make a new posting.

Thanks again,
Back to top


Reply to topic   Topic: Apache and perl cgi help needed View previous topic :: View next topic
Post new topic   Forum Index -> Other Software