0

I have here embedded device with linux. There is a webserver boa. http://www.boa.org/

I am trying to start sh cgi script.

#!/bin/sh
echo "Content-type: text/html\n"
echo "Hello world !"

./script.cgi works, but in webbrowser I get

502 Bad Gateway The CGI was not CGI/1.1 compliant.

Can anyone help me?

Chris Morgan
  • 86,207
  • 24
  • 208
  • 215
Meloun
  • 13,601
  • 17
  • 64
  • 93

3 Answers3

1

Try adding an extra \n on your content-type line.

Also, if there is a problem with your shebang or dos-style line endings, boa will report similarly.

Lisa
  • 439
  • 2
  • 8
1
echo -e "Content-type: text/html\r\n\r\n"
Jason Plank
  • 2,336
  • 5
  • 31
  • 40
Meloun
  • 13,601
  • 17
  • 64
  • 93
1

You have to do chmod:

chmod 777 your_cgi_file

or

chmod 755 your_cgi_file
Jason Plank
  • 2,336
  • 5
  • 31
  • 40
try_this
  • 11
  • 1