4 ms·
> Zero external configuration, other than telling your webserver to enable CGI on your file This is only true if you've done it before, and know what you're do
by jstrieb 4y ago
> Zero external configuration, other than telling your webserver to enable CGI on your file
This is only true if you've done it before, and know what you're doing. In reality, it looks like a mess of `mod_cgi` configuration, trying different combinations of file permissions, finding the magic `cgi_bin` directory, finding the right obscure log files when there are inevitably errors, wrestling with CORS and other subtleties of HTTP headers, and other complexities that are only easy to navigate if you're already an experienced CGI user.
That being said, I love the philosophy of using CGI for scripts. Instead of using CGI itself, though, I wrote a (single-file, statically-linked) web server called "QuickServ" to bring this philosophy into the twenty-first century. It has all of the upside of CGI, but is much easier to set up and run, especially for beginners.
One of its benefits is that it automatically parses submitted HTTP forms, and converts the form fields to command line arguments. That means it's extremely easy to put existing CLIs on the web with minimal changes other than writing an HTML form front-end.
If you like CGI, I will (shamelessly) ask that you check it out!
https://github.com/jstrieb/quickserv https://github.com/jstrieb/quickserv
https://news.ycombinator.com/item?id=29002694 https://news.ycombinator.com/item?id=29002694
- ilyt 4y agoI thought about that for few of the personal stuff but in the end I just opted to have a binary that's just http router + abstracted away way to handle requests. So when I need new feature I just add a module and deploy whole (that includes static files) blob. No need to create new service, add it to loadbalancer etc.
- iso1631 4y agoa2enmod cgi; service apache2 restart Then in your config file AddHandler cgi-script .cgi Options +ExecCGI