Hacker News new | past | comments | ask | show | jobs | submit login

Thank you! But I'm slipping into things I don't understand, and maybe you could illuminate. I assume that for both your examples, we are using, say Apache, to listen on port 80 and route requests to files. So how do you get apache to not just deliver the file as-is, "#!/usr/bin/python" and all? Does Apache typically know to execute and return the result?

Or if my questions aren't making sense, that would be good to know as well.




You can configure Apache to treat some files as CGI executables [1], which get invoked by their file path, read http requests on their standard in, and print http responses on their standard out. It's how most of "Web 1.0" was built, and it supports streaming in a way that most MVC frameworks don't.

[1] http://en.wikipedia.org/wiki/Common_Gateway_Interface


Sometimes if you haven't got things configured properly, you do return the script as text rather than the output of the script.

The old school default was to put executable in the cgi-bin folder (wherever that had been configured to be) and make them executable. That would run the script and return the output.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: