Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
ReadMe.txt | 2019-03-12 | 1.6 kB | |
lighttpd.docx | 2019-03-12 | 164.6 kB | |
hello.c | 2019-03-12 | 2.2 kB | |
testcgi.cpp | 2019-03-12 | 2.0 kB | |
Totals: 4 Items | 170.4 kB | 0 |
lighttpd + fastcgi + C(c++) study(学习) Server ubuntu 14.04 Config. (配置): 1. apt-get install lighttpd 2. apt-get install libfcgi 3. apt-get install libfcgi-dev 4. lighty-enable-mod cgi 5. lighty-enable-mod fastcgi A big trap is that you must compile the fcgi file OK then run service restart lighttpd 一个大坑,使用fastcgi必须先把fcgi编译出来才能 service restart lighttpd! 6. vim /etc/lighttpd/conf-enabled/10-fastcgi.conf server.modules += ( "mod_fastcgi" ) #fastcgi.debug = 1 fastcgi.server = ( "/hello" => ( "hello.fcgi.handler" => ( "socket" => "/tmp/hello.fcgi.socket", "check-local" => "disable", "bin-path" => "/var/www/cgi-bin/hello.fcgi", "max-procs" => 4, "min-procs" => 4 ) ) ) 7. vim /etc/lighttpd/lighttpd.conf static-file.exclude-extensions = ( ".php", ".pl", ".fcgi",".cgi" ) 8. mkdir -p /var/www/cgi-bin 建立c/c++文件,编译使用 g++ testcgi.cpp -o testcgi.cgi g++ hello.c -lfcgi -o hello.fcgi 9. perf. test 压力测试 1 core 2.2GHZ + 1GB RAM 单核2.2G 1G内存可以达到1000并发,cgi响应时间70秒,fcgi 7 秒 ,测试工具是 http_load CGI: reach 1000 para on CGI with most 70334 ms delay FCGI: 191325 fetches, 1000 max parallel, 3.57204e+08 bytes, in 30.0001 seconds 1867 mean bytes/connection 6377.49 fetches/sec, 1.19068e+07 bytes/sec msecs/connect: 83.1877 mean, 7015.58 max, 0.166 min msecs/first-response: 71.2008 mean, 1676.36 max, 36.255 min HTTP response codes: code 200 -- 191325