1 The application could be quite easily made to use FastCGI. Unlike normal CGI,
2 with FastCGI (fcgi), the process is executed once, and continues to run. The
3 process will receive responses from the browser in the response loop. Hence,
4 sensor data can be read in another thread while the response loop runs.
7 Compile fastcgi_test.c with: (the libfcgi-dev package must be installed)
8 gcc fastcgi_test.c -lfcgi -o fastcgi_test
10 Configure nginx to pass all requests to the address /cgi/ to the application:
11 Edit /etc/nginx/sites-enabled/default by adding the contents of nginx_server_config.txt
14 /etc/init.d/nginx restart
17 spawn-fcgi -p9005 -n ./fastcgi_test
19 You can see the results at:
20 http://your.domain/cgi