歡迎您光臨本站 註冊首頁

ubuntu 使用fastcgi和cgicc

←手機掃碼閱讀     火星人 @ 2014-03-24 , reply:0

安裝fastcgi 1)http://www.fastcgi.com/drupal/node/5 2)下載fcgi-2.4.0.tar.gz 3)sudo tar -xf fcgi-2.4.0.tar.gz 4)cd fcgi-2.4.0 5)./configure --prefix=/opt/fcgi 6) cd include 7) sudo chmod 777 fcgio.h 8)vim fcgio.h 9)在fcgio.h中添加#include 10)make 11)make install 12)安裝路徑 /opt/fcgi/下有bin,include和lib文件夾 自解壓目錄中有doc ubuntu使用fastcig 1)安裝apache2-- 用新立得軟體包管理器安裝apache2-bin和apache2-common 2)sudo apt-get install apache2 3)127.0.0.1測試 apache2 4)ubuntu默認安裝路徑 Ubuntu (Apache 2): ServerRoot :: /etc/apache2 DocumentRoot :: /var/www Apache Config Files :: /etc/apache2/apache2.conf :: /etc/apache2/ports.conf Default VHost Config :: /etc/apache2/sites-available/default, /etc/apache2/sites-enabled/000-default Module Locations :: /etc/apache2/mods-available, /etc/apache2/mods-enabled ErrorLog :: /var/log/apache2/error.log AccessLog :: /var/log/apache2/access.log cgi-bin :: /usr/lib/cgi-bin binaries (apachectl) :: /usr/sbin start/stop :: /etc/init.d/apache2 (start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean) 5)修改cgi-bin目錄 5.1)cd /etc/apache2/sites-enabled 5.2)sudo chmod 777 000-default 5.3)vim 000-default 5.4)將ScriptAlias /cgi-bin/ /usr/lib/cgi-bin 修改為ScriptAlias /cgi-bin/ /var/www/cgi-bin 5.5) 將 AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all 改為 AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all 6)創建cgi-bin目錄 6.1)cd /var 6.2)sudo chmod -R 777 www 6.3)在/var/www/創建目錄cgi-bin -- mkdir cgi-bin 6.4)sudo chmod -R 777 cgi-bin 7)安裝cgicc 7.1)http://www.gnu.org/software/cgicc下載cgicc 7.2)解壓 7.3)cd cgicc-3.2.9 7.4)./configure --prefix=/usr 7.5)make -- 如果發現html無法通過,不用管理 7.6)sudo make install 7.8)安裝后得文件目錄 /usr/inlcude/cgicc /usr/lib/libcgicc.a 8)創建簡單用例 8.1)在/var/www/下創建fcgi.html test fcgi

8.2)在/var/www/cgi-bin下創建fcig.cpp #include #include #include #include "cgicc/CgiDefs.h" #include "cgicc/Cgicc.h" #include "cgicc/HTTPHTMLHeader.h" #include "cgicc/HTMLClasses.h" using namespace std; int main(int argc,char* argv[]) { while(FCGI_Accept() >=0) { Cgicc cgi; string strName,strAge; form_iterator iterName; form_iterator iterAge; iterName = cgi.getElement("name"); strName = iterName->getValue(); iterAge = cgi.getElement("age"); strAge = iterAge->getValue(); printf("Content-Type:text/html\n\n"); printf(strName.c_str()); printf(strAge.c_str()); return 0; } } 8.3)makefile fcgi:fcgi.cpp g++ -o fcgi fcgi.cpp -I/usr/include -L/usr/lib -lcgicc -I/opt/fcgi/include -L/opt/fcgi/lib -lfcgi 8.4)在/ect/ld.so.conf中添加一行,將libfcgi.so.0的路徑包含, include /etc/ld.so.conf.d/*.conf /opt/fcgi/lib 8.5)sudo ldconfig 8.6)重啟apache2

[火星人 ] ubuntu 使用fastcgi和cgicc已經有763次圍觀

http://coctec.com/docs/linux/show-post-141043.html