Running A CGI Written In C - Acme Systems

Toggle navigation
  • Home
  • eShop
    • Price list
    • Tracking
    • Send money
    • Terms
  • Doc
    • Main index
    • Declarations of conformity
    • Index by SOM
    • How to recognize a card
    • Downloads
    • Troubleshooting
    • Support channels
  • Company
    • Contact us
    • About us
    • Where we are

FOX Board G20 technical documentation Buy

Running a CGI written in C This article illustrates how to config lighttpd web server to run cgi written in C

Hello world example

Save this "Hello world !" source code example in /var/www/cgi-bin (create this directory if it not exists).

#include "stdio.h" int main(void) { printf( "Content-Type: text/plain\n\n" ); printf("Hello world !\n"); return 0; }

Compile it typing:

debarm:~# gcc hello.c -o hello.cgi

lighttpd configuration

Change the server.modules list inside /etc/lighttpd/lighttpd.conf in:

server.modules = ( "mod_access", "mod_cgi", "mod_alias", "mod_accesslog", "mod_compress", )

and add these lines:

$HTTP["url"] =~ "/cgi-bin/" { cgi.assign = ( "" => "" ) } cgi.assign = ( ".cgi" => "" )

Restart lighttpd typing:

debarm:~# /etc/init.d/lighttpd restart

Final test

Access with your browser to the FOX Board web page using this URL:

http:///cgi-bin/hello.cgi

Home page FOX Board G20 technical documentation Buy

Acme Systems logo Acme Systems srl - Electronic design and manufacturing since 2005 Sede operativa: Via Aldo Moro 53 - 00055 Ladispoli (RM) - Italy VAT / Partita IVA / Codice Fiscale: IT 08114831004 Codice SDI: SUBM70N email: [email protected] - PEC: [email protected] - Tel: +39.06.99.12.187 - Fax: +39.06.622.765.31 Iscritta al Registro delle Imprese di Roma al n. 08114831004 - REA: RM-1074631 Sede legale: Viale dell'Umanesimo 199 - 00144 Roma Partners Privacy policy Term & conditions Tracking Contact us About us Declarations Where we are

Từ khóa » C Cgi