IMHO a relatively cleaner hack (from a software engineering point of view, and also security-wise) is to have an in-kernel web server serving static content, and to have configuration file(s) in /proc that can tell this kernel server to pass requests for dynamic data to a user-space daemon.

For example, khttpd can run on port 80, and a PHP (or whatever else) enabled web server, say Apache, on port 8080. We tell khttpd to pass on cgi-bin and PHP related requests to Apache. Indeed, the latest khttpd in the Linux kernel works this way.

Regards
Amit