如何使用mod_fastcgi模块编写C ++ Web服务 [英] how to use mod_fastcgi module to write c++ webservice

查看:64
本文介绍了如何使用mod_fastcgi模块编写C ++ Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用apache作为webserver来为linux编写c ++ webservice.i我是第一次在linux上工作,所以我需要您的帮助.

遵循Fast_Cgi网站给出的说明.





我已经从"http://www.fastcgi.com/drupal/"站点下载了工具包"mod_fast_cgi-2.4.6.tar.tar".

然后,我按照工具箱中的"INSTALL.AP2"文件中给出的说明进行操作.

我能够生成"fast_cgi.so文件".现在该文件位于我的目录中







配置httpd.conf



下一步是在我的
中进行更改


在http.conf文件中–

我在httpd.conf文件的开头添加了"LoadModule fastcgi_module modules/mod_fastcgi.so"



然后他们说要在虚拟主机指令之前添加这些内容





FastCgiIpcDir/tmp/fcgi_ipc/

AddHandler fastcgi-script .fcgi





示例C ++程序



我的测试程序"Testwebservice.cpp"看起来像这样



#include"fcgi_stdio.h"/* fcgi库;放在第一位*/



#include



整数计数;



无效的initialize(void)

{

count = 0;

}



int main(void)

{

/*初始化. */

initialize();



/*响应循环. */

while(FCGI_Accept()> = 0){

printf("Content-type:text/html \ r \ n"

"\ r \ n"

< title> FastCGI您好!(C,fcgi_stdio库)</title>"

"FastCGI您好!(C,fcgi_stdio库)"

请求号%d在主机%s上运行\ n",

++ count,getenv("SERVER_HOSTNAME"));

}

返回0;

}



我觉得我在虚拟主机指令之前添加的指令中缺少某些内容.

你能帮我知道我在这里想念什么吗?

我必须在httpd.conf文件中添加什么内容,它将把到达apache网络服务器的http请求定向到我的c ++应用程序. (如果我没记错的话)对于相同的问题...?您可以在同一问题中继续通过评论提问...
请点击链接..
链接
如果您不愿意在同一问题中提问,则无需为同一类型创建多个问题.


1. 研究和理解概念
2.获取所需的工具
3.编写代码
4.编译
5.如果没有错误,请转到7.
6.调试/修复,转到#3.

7. .....


:提醒自己忽略ID十个T错误的张贴者:


I am looking at writing c++ webservice for linux with apache being the webserver.i am working on linux for first time so i needed your help.

Am follwing the instructions given by Fast_Cgi site.





I have downloaded the toolkit "mod_fast_cgi-2.4.6.tar.tar" from the site " http://www.fastcgi.com/drupal/".

Then i followed the instructions given in "INSTALL.AP2" file which is present in toolkit.

I was able to generate "fast_cgi.so file". Now this file is located in my directory







Configuring httpd.conf



next step is to make changes in my



In http.conf file –

I have added "LoadModule fastcgi_module modules/mod_fastcgi.so" in the begining of the httpd.conf file



then they have said to add these things before virtual host directive





FastCgiIpcDir /tmp/fcgi_ipc/

AddHandler fastcgi-script .fcgi





Sample C++ program



my test program "Testwebservice.cpp" looks like this



#include "fcgi_stdio.h" /* fcgi library; put it first*/



#include



int count;



void initialize(void)

{

count=0;

}



int main(void)

{

/* Initialization. */

initialize();



/* Response loop. */

while (FCGI_Accept() >= 0) {

printf("Content-type: text/html\r\n"

"\r\n"

"<title>FastCGI Hello! (C, fcgi_stdio library)</title>"

"FastCGI Hello! (C, fcgi_stdio library)"

"Request number %d running on host %s\n",

++count, getenv("SERVER_HOSTNAME"));

}

return 0;

}



I feel am missing something in the directive which i added just before the virtual host directive.

could you help me to know what am i missing here.

what is that i have to add in httpd.conf file which will direct the http requests coming to the apache webserver to my c++ application.

解决方案

this is the third tread(if i am not wrong) for the same question...?? you can continue ask through comment in the same question...
follow the link..
link
if you dont understand feel free to ask in the same Question, no need to create multiple question for the same type.


1. Study and understand concepts
2. Get required tools
3. Write code
4. Compile
5. If no errors, goto 7.
6. Debug/Fix, goto #3.

7. .....


:reminds self to ignore posters suffering from the ID ten T error:


这篇关于如何使用mod_fastcgi模块编写C ++ Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆