News for hackers. Stuff that matters.
Re:Show HN: Neh – Execute any script or program from Nginx l... by cnorthwood on Monday March 23, 2020 @08:38PM (#22670555)
And we've come back round full circle from CGI scripts, although separating out headers and body on different fds sounds neat
Re:Show HN: Neh – Execute any script or program from Nginx l... by CodeWriter23 on Monday March 23, 2020 @11:15PM (#22671528)
Many things we’ve dispensed with long ago seem to be forgotten and the younger coders are learning for themselves the hard way. Aka the same way we did.
Re:Show HN: Neh – Execute any script or program from Nginx l... by badrabbit on Tuesday March 24, 2020 @01:52AM (#22672360)
Except with a lot of learned lessons applied.
Re:Show HN: Neh – Execute any script or program from Nginx l... by oap_bram on Tuesday March 24, 2020 @04:52AM (#22673144)
One of the things I'm wondering however: How popular is CGI if I don't find it with the query "run script on nginx location directive".
Re:Show HN: Neh – Execute any script or program from Nginx l... by westurner on Tuesday March 24, 2020 @05:10AM (#22673212)
Nginx probably somewhat-deliberately has FastCGI but not regular CGI for a number of reasons.

CGI has process-per-request overhead.

CGI typically runs processes as the user the webserver is running as; said processes can generally read and write to the unsandboxed address space of the calling process (such as x.509 private certs).

Just about any app can be (D)DOS'd. That requires less resources with the process-per-request overhead of CGI.

In order to prevent resource exhaustion due to e.g someone benignly hitting reload a bunch of times and thus creating multiple GET requests, applications should enqueue task messages which a limited number of workers retrieve from a (durable) FIFO or priority queue and update the status of.

Websockets may or may not scale better than long-polling for streaming stdout to a client.

Re:Show HN: Neh – Execute any script or program from Nginx l... by oap_bram on Tuesday March 24, 2020 @05:14AM (#22673221)
Interesting and really informative! Thanks for sharing!
Re:Show HN: Neh – Execute any script or program from Nginx l... by minhoryang on Tuesday March 24, 2020 @07:40AM (#22673997)
nginx is not for CGI that's why no result showed. CGI was popular at 1990-early 2000. Even apm(apache php mysql) relied on CGI between apache and php.
Re:Show HN: Neh – Execute any script or program from Nginx l... by icedchai on Tuesday March 24, 2020 @09:20AM (#22674584)
When using Apache, PHP was mostly commonly deployed as an Apache module (mod_php.) Almost nobody ran it as CGI unless they had no other choice. mod_php felt very, very fast compared to alternatives.

I remember doing "custom compiles" for a number of local early web host / Internet providers because their admins didn't want to build C code.

Re:Show HN: Neh – Execute any script or program from Nginx l... by oap_bram on Tuesday March 24, 2020 @04:48AM (#22673131)
Thank you for the kind words! The general consensus on the article is "why don't you just use CGI", and suppose you guys are right. I just didn't find CGI to be in an option in the searching that I did. I'm surprised too, looking back now tbh.
Re:Show HN: Neh – Execute any script or program from Nginx l... by minhoryang on Tuesday March 24, 2020 @07:41AM (#22674004)
Recreate same thing without knowing cgi is awesome.
Re:Show HN: Neh – Execute any script or program from Nginx l... by Natsu on Monday March 23, 2020 @09:03PM (#22670697)
Yeah, this seems nice for small scripts and all, but I wonder how long until scope creep makes them end up writing or replacing this with an API gateway?