PDA

View Full Version : Premature end of script headers: CGI"


fatturi
2005-10-11, 02:23 AM CDT
I am having a lot of difficulty configuring httpd.conf to handle CGI.

I edited httpd.conf to add the Alias and ScriptAlias directives as
described in the nagios documentation.

I'm able to access the documentation, but i cannot manage the CGI commands, I keep getting the error: "Premature end of script headers: CGI"


i am trying to get nagios to work (Version: 2.0 Release: 0.b4.1)
with my FEDORA core 4, apache 2.0.43 webserver.

when i login to the specified url (http://localhost/nagios) i get to see the nagios index page,
but when i click the left hand menu the page will not load and will give me an internal server error.

when i browse httpd-error.log i find out it gives me this error:

[error] Pemature end of script headers: *.CGI referer: http://127.0.0.1/nagios/side.html

last but not least i'll put my httpd.conf additions for nagios:

ScriptAlias /nagios/cgi-bin/ /usr/local/bin/nagios/
<Directory "/usr/local/bin/nagios/">
AllowOverride AuthConfig
Options ExecCGI
Order allow,deny
Allow from all
</Directory>

Alias /nagios /usr/local/share/nagios/
<Directory "/usr/local/share/nagios/">
Options None
AllowOverride Authconfig
Order allow,deny
Allow from all
</Directory>

can be this problem due to a different users group? or a wrong setting of external cgi in http.conf?

any help?

thank you very much!

Spoon!
2005-10-11, 02:43 AM CDT
Maybe it's a problem with your CGI scripts? Are you sure they work correctly?

fatturi
2005-10-11, 02:55 AM CDT
yes i think, because they are the documentation's scripts...

grosminet
2006-10-09, 06:50 AM CDT
I have a big problem for web interface on nagios
i can acees to home page by 127.0.0.1/nagios
nagios has no error when i run this command
nagios -v nagios.cfg
i create a file passwd in the directory etc/nagios
because the error_log of apache don't find teh authentification in this type of files
privileges of the directory "/usr/lib/nagios/cgi-bin"
ls -ali
total 2440

1530548 drwxr-xr-x 2 root root 4096 sep 29 20:49 .
1530546 drwxr-xr-x 4 root root 4096 mai 8 11:09 ..
1528101 -rwxr-xr-x 1 root root 173868 aoû 3 06:33 avail.cgi
1528087 -rwxr-xr-x 1 root root 184172 aoû 3 06:33 cmd.cgi
1528090 -rwxr-xr-x 1 root root 136944 aoû 3 06:33 config.cgi
1528085 -rwxr-xr-x 1 root root 195344 aoû 3 06:33 extinfo.cgi
1528102 -rwxr-xr-x 1 root root 145556 aoû 3 06:33 histogram.cgi
1528095 -rwxr-xr-x 1 root root 125264 aoû 3 06:33 history.cgi
1528092 -rwxr-xr-x 1 root root 121684 aoû 3 06:33 notifications.cgi
1528099 -rwxr-xr-x 1 root root 122768 aoû 3 06:33 outages.cgi
1528083 -rwxr-xr-x 1 root root 120848 aoû 3 06:33 showlog.cgi
1528086 -rwxr-xr-x 1 root root 178608 aoû 3 06:33 status.cgi
1528094 -rwxr-xr-x 1 root root 137140 aoû 3 06:33 statusmap.cgi
1528096 -rwxr-xr-x 1 root root 134896 aoû 3 06:33 statuswml.cgi
1528091 -rwxr-xr-x 1 root root 120688 aoû 3 06:33 statuswrl.cgi
1528093 -rwxr-xr-x 1 root root 142032 aoû 3 06:33 summary.cgi
1528103 -rwxr-xr-x 1 root root 137548 aoû 3 06:33 tac.cgi
1528082 -rwxr-xr-x 1 root root 149972 aoû 3 06:33 trends.cgi
the conf of httpd.conf for nagios
ScriptAlias /nagios/cgi-bin "/usr/lib/nagios/cgi-bin"
<Directory "/usr/lib/nagios/cgi-bin">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
Require valid-user
</Directory>

Alias /nagios "/usr/share/nagios"

<Directory "/usr/share/nagios">
Options None
AllowOverride None
Order allow,deny
Allow from all
# AuthName "Nagios Access"
# AuthType Basic
# AuthUserFile /etc/nagios/passwd
# Require valid-user
Allow from all
</Directory>
par contre impossible to run the script
log de access_log par tail
127.0.0.1 - nagiosadmin [09/Oct/2006:12:12:29 +0200] "GET /nagios/cgi-bin//tac.cgi HTTP/1.1" 500 608 "http://127.0.0.1/nagios/side.html" "Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.8.0.7) Gecko/20060913 Fedora/1.5.0.7-1.fc5 Firefox/1.5.0.7 pango-text"
tail de error_log
[Mon Oct 09 12:12:29 2006] [error] [client 127.0.0.1] (13)Permission denied: exec of '/usr/lib/nagios/cgi-bin/tac.cgi' failed, referer: http://127.0.0.1/nagios/side.html
[Mon Oct 09 12:12:29 2006] [error] [client 127.0.0.1] Premature end of script headers: tac.cgi, referer: http://127.0.0.1/nagios/side.html
the script cgi are in "/usr/lib/nagios/cgi-bin"
have you find a mistake

Linuxnizer
2006-12-22, 03:31 PM CST
Just make sure your cgi-bin can execute Perl. change /cgi-bin with your cgi-bin path.

<Directory /cgi-bin>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Directory>

Cheers

gavinw6662
2006-12-22, 08:13 PM CST
might be SE-linux as well. Do you have it activated?

setenforce 0

and then try it again. Also - maybe you need some sort of perl module. Are you seeing any perl mod errors?