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 -> Apache View previous topic :: View next topic
Reply to topic   Topic: cgi-bin script 403 Forbidden
Author
moh3en



Joined: 03 Aug 2020
Posts: 4
Location: Germany

PostPosted: Tue 04 Aug '20 8:19    Post subject: cgi-bin script 403 Forbidden Reply with quote

Hello,

I want work in .cgi file Programing in appache but tell me this error

in windows in edit this path httpd.conf

Code:


<Directory "/www/cgi-bin/">
 Options +ExecCGI
 AddHandler cgi-script .cgi .pl
 Order allow,deny
 Allow from all
</Directory>

<Files ~ "\.cgi$">
   Options Indexes FollowSymLinks ExecCGI
   Options +ExecCGI
   AddHandler cgi-script .cgi
</Files>
<Files ~ "\.pl$">
   Options Indexes FollowSymLinks ExecCGI
   Options +ExecCGI
   AddHandler cgi-script .pl
</Files>


But still i get 403 Forbidden

Also add in first line of my script this path for perl

Code:
#!C:\Strawberry\perl\bin\perl.exe


How solve it? Please help me
Back to top
glsmith
Moderator


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

PostPosted: Tue 04 Aug '20 17:18    Post subject: Reply with quote

Try using

Required all granted

and not

Order allow,deny
Allow from all


2.4 does not like the old style much even with the compat module loaded.

Also, you may added logging for other cgi errors with

ScriptLog /path/to/script-error.log

can be useful trying to figure out other problems
Back to top
moh3en



Joined: 03 Aug 2020
Posts: 4
Location: Germany

PostPosted: Tue 04 Aug '20 23:09    Post subject: Reply with quote

glsmith wrote:
Try using

Required all granted

and not

Order allow,deny
Allow from all


2.4 does not like the old style much even with the compat module loaded.

Also, you may added logging for other cgi errors with

ScriptLog /path/to/script-error.log

can be useful trying to figure out other problems


I added:
Require all granted
and remove:
Order allow,deny
Allow from all

But still when open http://localhost/cgi-bin/ tell me error 403 Forbidden

--------

This my httpd.conf file:

Mod note: Moved the config to: https://apaste.info/gw9z


Also first line of my file in windows is like:

#!c:\perl64\bin\PERL.EXE

I don't use Linux i have not this path

ScriptLog /path/to/script-error.log
Back to top
glsmith
Moderator


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

PostPosted: Wed 05 Aug '20 2:43    Post subject: Reply with quote

I think your problem is the uncommented ScriptAlias line.
Any URL to your sever that calls cgi-bin is going to look for files at "C:/AppServ/Apache24/cgi-bin/".

The ScriptAlias is global and overrides any cgi-bin unless it's specifically added in a virtual host or directory container further in the config.

ScriptAlias stays commented out on my server so I can have many different domain specific /cgi-bin locations.

---

/path/to just means "wherever you want," just make sure it's a valid location. For ease however,

ScriptLog logs/script-error.log

will put it in Apache's logs folder at C:/AppServ/Apache24/logs/script-error.log
Back to top
moh3en



Joined: 03 Aug 2020
Posts: 4
Location: Germany

PostPosted: Wed 05 Aug '20 6:36    Post subject: Reply with quote

glsmith wrote:
I think your problem is the uncommented ScriptAlias line.
Any URL to your sever that calls cgi-bin is going to look for files at "C:/AppServ/Apache24/cgi-bin/".

The ScriptAlias is global and overrides any cgi-bin unless it's specifically added in a virtual host or directory container further in the config.

ScriptAlias stays commented out on my server so I can have many different domain specific /cgi-bin locations.

---

/path/to just means "wherever you want," just make sure it's a valid location. For ease however,

ScriptLog logs/script-error.log

will put it in Apache's logs folder at C:/AppServ/Apache24/logs/script-error.log


But i doni't have this path

Quote:
"C:/AppServ/Apache24/cgi-bin/".


Correct path for my computer for cgi-bin folder is in www

Code:
C:/AppServ/www/cgi-bin/


Can tell me how add ScriptAlias in virtual host or directory container further in the config ?

Also need modify .htaccess file ?
Back to top
glsmith
Moderator


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

PostPosted: Wed 05 Aug '20 20:20    Post subject: Reply with quote

moh3en wrote:
But i doni't have this path
Quote:
"C:/AppServ/Apache24/cgi-bin/".


Correct path for my computer for cgi-bin folder is in www
Code:
C:/AppServ/www/cgi-bin/


Yeah you don't and that is a bug in AppServ's config looking inside the latest download at SourceForge.

But if ${SRVROOT} == C:/AppServ/Apache24
then
ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/" == C:/AppServ/Apache24/cgi-bin/

Understand how I am getting that path?

moh3en wrote:
Can tell me how add ScriptAlias in virtual host or directory container further in the config ?


No, because it's already explained in Apache's docs but it's unfortunate that it doesn't have a German translation.
http://httpd.apache.org/docs/2.4/en/sections.html

moh3en wrote:
Also need modify .htaccess file ?

Read this first because as AppServ is configure, you cannot use htaccess files
http://httpd.apache.org/docs/2.4/howto/htaccess.html

Sorry but I do expect you to understand a little about what your working with first.
Back to top
moh3en



Joined: 03 Aug 2020
Posts: 4
Location: Germany

PostPosted: Thu 06 Aug '20 7:19    Post subject: Reply with quote

Thank you for help,

I remove appserv and Try for install xampp and make a new folder in htdos/cgi/ and put jmarshall.cgi in this folder

now open from browser tell me

Code:
502 Bad Gateway


i have been added in httpd.conf this line but still 502 Bad Gateway

Code:
I have Try install jmarshall cgi proxy
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 10 Aug '20 11:20    Post subject: Reply with quote

Hi Moh3en,
xampp has by default a directory for that c:\xampp\cgi-bin

There is no need to change the config. Just place your file in that folder and open http://localhost/cgi-bin/jmarshall.cgi
Back to top


Reply to topic   Topic: cgi-bin script 403 Forbidden View previous topic :: View next topic
Post new topic   Forum Index -> Apache