Lighttpd는 어디에서나 500에 대한 오류를 인쇄하지 않습니까?

Lighttpd는 어디에서나 500에 대한 오류를 인쇄하지 않습니까?

나는 내가 실행하고 있는 일부 노드에 대해 간단한 "살아있는" 서버로 lighttpd를 사용하려고 합니다. 그러나 제가 실행 중인 스크립트에서는 비결정적으로 500개의 오류가 발생하며 어디에서도 해당 오류를 찾을 수 없습니다.

내 디버깅 구성은 다음과 같습니다.

server.document-root = "/var/www/health_checker"

server.port = 44445
server.modules += ("mod_auth", "mod_rewrite", "mod_accesslog", "mod_cgi", "mod_redirect", "mod_status" )

cgi.assign = ( ".sh" => "/bin/sh" )

url.rewrite-once = (
      "^/healthz"  => "/healthz.sh",
      "^/.*" => "/livez.sh" 
)

server.error-handler-404   = "/livez.sh"
server.errorlog            = "/home/aronchick/temperror.log"
server.breakagelog         = "/home/aronchick/tempcgi.log"
server.accesslog           = "/home/aronchick/tempaccess.log"

debug.log-request-header             = "enable"
debug.log-request-header-on-error    = "enable"
debug.log-response-header            = "enable"
debug.log-file-not-found             = "enable"
debug.log-request-handling           = "enable"
debug.log-condition-handling         = "enable"
debug.log-condition-cache-handling   = "enable"
debug.log-ssl-noise                  = "enable"
debug.log-timeouts                   = "enable"

다음은 비결정론의 예입니다.

aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
{ 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
 </body>
</html>
aronchick@myservice-vm-0:~$ 
aronchick@myservice-vm-0:~$ curl 0.0.0.0:44445/livez.sh
{ 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}
aronchick@myservice-vm-0:~$ ps aux

500 오류가 어디에 기록되고 있는지조차 알 수 없습니다. 다음은 다음과 같습니다 /home/aronchick/temperror.log.

2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: GET / HTTP/1.1
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: Host: 127.0.0.1:44445
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: User-Agent: curl/7.81.0
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: Accept: */*
2022-06-19 19:29:37: (connections.c.771) fd:8 rqst: 
2022-06-19 19:29:37: (response.c.407) -- parsed Request-URI
2022-06-19 19:29:37: (response.c.409) Request-URI     : /
2022-06-19 19:29:37: (response.c.411) URI-scheme      : http
2022-06-19 19:29:37: (response.c.413) URI-authority   : 127.0.0.1:44445
2022-06-19 19:29:37: (response.c.415) URI-path (clean): /
2022-06-19 19:29:37: (response.c.417) URI-query       : 
2022-06-19 19:29:37: (response.c.407) -- parsed Request-URI
2022-06-19 19:29:37: (response.c.409) Request-URI     : /livez.sh
2022-06-19 19:29:37: (response.c.411) URI-scheme      : http
2022-06-19 19:29:37: (response.c.413) URI-authority   : 127.0.0.1:44445
2022-06-19 19:29:37: (response.c.415) URI-path (clean): /livez.sh
2022-06-19 19:29:37: (response.c.417) URI-query       : 
2022-06-19 19:29:37: (response.c.495) -- logical -> physical
2022-06-19 19:29:37: (response.c.497) Doc-Root     : /var/www/health_checker
2022-06-19 19:29:37: (response.c.499) Basedir      : /var/www/health_checker
2022-06-19 19:29:37: (response.c.501) Rel-Path     : /livez.sh
2022-06-19 19:29:37: (response.c.503) Path         : /var/www/health_checker/livez.sh
2022-06-19 19:29:37: (response.c.522) -- handling subrequest
2022-06-19 19:29:37: (response.c.524) Path         : /var/www/health_checker/livez.sh
2022-06-19 19:29:37: (response.c.526) URI          : /livez.sh
2022-06-19 19:29:37: (response.c.528) Pathinfo     : 
2022-06-19 19:29:37: (response.c.164) fd:8 resp: HTTP/1.1 500 Internal Server Error
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Content-Type: text/html
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Content-Length: 365
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Date: Sun, 19 Jun 2022 19:29:37 GMT
2022-06-19 19:29:37: (response.c.164) fd:8 resp: Server: lighttpd/1.4.63
2022-06-19 19:29:37: (response.c.164) fd:8 resp: 

답변1

스크립트가 응답을 반환하지 못하면 lighttpd는 500 내부 서버 오류를 반환합니다.

CGI 스크립트가 아마도 다음을 따르지 않을 것입니다.CGI 사양.

? CGI 스크립트가 다음과 같은 작업을 수행합니까?

printf "Status: 200\nContent-Type: application/json\n\n"

인쇄하기 전에 { 'hostname': 'myservice-vm-0.us-east4-c.c.myservice-production.internal', 'date': '2022-06-19 19:38:37.445066814+00:00', 'ip': 'xx.xx.xx.xx'}?

관련 정보