# lighttpd_fcgi **Repository Path**: hbbing/fcgi ## Basic Information - **Project Name**: lighttpd_fcgi - **Description**: 主要是lighttpd+fcgi开发 - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-01 - **Last Updated**: 2021-11-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # lighttpd_fcgi #### Description 主要是lighttpd+fcgi开发 1) 安装lighttpd sudo apt-get install lighttpd 如果没有fcgi开发包需要安装 sudo apt-get install libfcgi-dev 2) 配置lighttpd + fastcgi vim /etc/lighttpd/conf.d/fastcgi.conf fastcgi.debug = 1 fastcgi.server = ( "/hello" => ( "hello.fcgi.handler" => ( "socket" => "/tmp/hello.fcgi.socket", "check-local" => "disable", "bin-path" => "/home/user/fcgiws/hello.fcgi", "max-procs" => 1 ) ) 编写 hello.c #include #include #include int main() { int count; count = 0; while (FCGI_Accept() >= 0) { printf("Content-type:application/json\r\n\r\n"); printf("{\"retcode\":0, \"request\":{\"id\":%d, \"count\":%d}}", getpid(), count++); } return 0; } ) 编译为 hello.fcgi gcc hello.c -lfcgi -o hello.fcgi #必须链接libfcgi 复制到文件夹:cp hello.fcgi /home/user/fcgiws/ 然后可以访问网址:) http://localhost/hello;