LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-08-2019, 12:12 PM   #1
indraindrajit71
LQ Newbie
 
Registered: Sep 2013
Posts: 18

Rep: Reputation: Disabled
Angry cgi-bin always has 404 error


Hello

I am trying to access a cgi script via an html page.
But it gives 404 error every time.


Not Found

The requested URL /EF="cgi-bin/test.cgi" was not found on this server.



##my html page##
test.html
<A HREF=EF="cgi-bin/test.cgi"> Click here to run a CGI program</A>



<VirtualHost *:80>
ServerName www.example.com


DocumentRoot "/var/www/cgi-bin/"


<Directory "/var/www/cgi-bin/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>

## Logging
ErrorLog "/var/log/httpd/error.log"
ServerSignature Off
CustomLog "/var/log/httpd/access.log" combined
## Script alias directives
ScriptAlias /cgi-bin "/var/www/cgi-bin/"
</VirtualHost>



PS: the permissions of the html file is:
-rwxr-xr-x. 1 apache apache 67 Feb 8 22:28 test.html


-rwxr--r--. 1 apache apache 390 Feb 7 00:30 test.cgi



also note that if I run the cgi-bin/test.cgi directly from browser,it works fine.


Please help !

Last edited by indraindrajit71; 02-08-2019 at 12:31 PM.
 
Old 02-08-2019, 12:34 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,376

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
Quote:
Originally Posted by indraindrajit71 View Post
Hello

I am trying to access a cgi script via an html page.
But it gives 404 error every time.


Not Found

The requested URL /EF="cgi-bin/test.cgi" was not found on this server.



##my html page##
test.html
<A HREF=EF="cgi-bin/test.cgi"> Click here to run a CGI program</A>
That's a pretty clear error message! Your <a> tag is not correct. It should be:
Code:
<A HREF="cgi-bin/test.cgi"> Click here to run a CGI program</A>
Why did you put the EF= in the href? It's obviously not in the url.

Last edited by scasey; 02-08-2019 at 12:36 PM.
 
1 members found this post helpful.
Old 02-08-2019, 12:37 PM   #3
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,329

Rep: Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026
Quote:
Originally Posted by indraindrajit71 View Post
Hello
I am trying to access a cgi script via an html page. But it gives 404 error every time.
Code:
Not Found
The requested URL /EF="cgi-bin/test.cgi" was not found on this server.
##my html page##
Code:
test.html
<A HREF=EF="cgi-bin/test.cgi"> Click here to run a CGI program</A>
Code:
<VirtualHost *:80>
  ServerName www.example.com
  DocumentRoot "/var/www/cgi-bin/"
  <Directory "/var/www/cgi-bin/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Require all granted
  </Directory>

  ## Logging
  ErrorLog "/var/log/httpd/error.log"
  ServerSignature Off
  CustomLog "/var/log/httpd/access.log" combined
  ## Script alias directives
  ScriptAlias /cgi-bin "/var/www/cgi-bin/"
</VirtualHost>
PS: the permissions of the html file is:
-rwxr-xr-x. 1 apache apache 67 Feb 8 22:28 test.html
-rwxr--r--. 1 apache apache 390 Feb 7 00:30 test.cgi

also note that if I run the cgi-bin/test.cgi directly from browser,it works fine.
Please put your configs/files in CODE tags. And did you read and think about what you posted??? You have the document ROOT set to be /var/www/cgi-bin (which is a bad idea), then your web page calls 'cgi-bin/test.cgi'. Meaning that you would need a /var/www/cgi-bin/cgi-bin path. Also, you need to check the syntax on calling that 'web page', as you may need to modify your path (such as './test.cgi' or the like.) And your HREF tag is wrong...why the extra EF?

:: EDIT :: scasey beat me to it.

Last edited by TB0ne; 02-08-2019 at 12:38 PM.
 
Old 02-08-2019, 01:35 PM   #4
indraindrajit71
LQ Newbie
 
Registered: Sep 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
thanks much to both gentleman !

made changes in httpd.conf

DocumentRoot "/var/www/html/test.html"
<Directory "/var/www/html/">

and it works perfectly.

Another help which I would like to have is:
I added another cgi script in the html but the output is bit closer (both tabs) when fired from browser.Meaning I wanted to have the tabs both in vertical position with bit of space.since I need to have at-least 10-20 different CGI's with separate links that's why needed this.later I will try to make the looks of that page look bit attractive by reading blogs or steps.
sorry for the ask but this is really killing me.


cat test.html
<A HREF="cgi-bin/test.cgi"> Click here to run a CGI program</A>
<A HREF="cgi-bin/test2.cgi"> nova listing of VM</A>
Attached Thumbnails
Click image for larger version

Name:	Capture.JPG
Views:	6
Size:	12.9 KB
ID:	29737  
 
Old 02-08-2019, 04:04 PM   #5
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,376

Rep: Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551Reputation: 1551
Put each anchor tag in paragraph <p> tags
Or
Separate them with <br> tags

Please search for “html syntax”
 
1 members found this post helpful.
Old 02-09-2019, 06:47 AM   #6
indraindrajit71
LQ Newbie
 
Registered: Sep 2013
Posts: 18

Original Poster
Rep: Reputation: Disabled
thanks to both of you.


closing this thread !
 
  


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
Cant seem to run any cgi scripts in cgi-bin folder, confused? j.smith1981 Linux - Server 5 02-14-2011 06:38 AM
echo $PATH = /home/g3rc4n/bin:/usr/local/bin:/usr/bin:/bin:/usr/games ? i_heart_pandas Linux - Software 7 09-18-2009 09:33 AM
Command ls --color=always, can always be always Kevin Tough Linux - Newbie 1 09-09-2005 12:05 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 09:49 PM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 08:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:25 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