[Cppcms-users] Can't get lighttpd to work with cppcms in Windows 7
Brought to you by:
artyom-beilis
|
From: Vizcayno <viz...@gm...> - 2013-06-22 23:34:50
|
Hello:
I have the next hello.cpp program:
#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/service.h>
#include <cppcms/http_response.h>
#include <iostream>
class hello : public cppcms::application {
public:
hello(cppcms::service &srv) :
cppcms::application(srv)
{
}
virtual void main(std::string url);
};
void hello::main(std::string /*url*/)
{
response().out() <<
"<html>\n"
"<body>\n"
" <h1>Hello World</h1>\n"
"</body>\n"
"<script language=\"javascript\">\n"
"<!--\n"
"today = new Date();\n"
"document.write(\"<BR>The time now is: \", today.getHours(),
\":\",today.getMinutes(),\":\",today.getSeconds());\n"
"document.write(\"<BR>The date is: \", today.getDate(),\"/\",
today.getMonth()+1,\"/\",today.getFullYear());\n"
"//-->\n"
"</script>\n"
"</html>\n";
}
int main(int argc,char ** argv)
{
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(
cppcms::applications_factory<hello>()
);
srv.run();
}
catch(std::exception const &e) {
std::cerr << e.what() << std::endl;
}
}
======================================================================
The configuration file that I called configLH.js contains:
{
"service" : {
"api" : "fastcgi",
"ip": "127.0.0.1" ,
"port" : 80
}
}
======================================================================
The configuration of lighttpd contains:
server.modules = (
"mod_access",
"mod_accesslog",
"mod_fastcgi",
"mod_rewrite",
"mod_status",
)
include "variables.conf"
include "mimetype.conf"
server.document-root = server_root + "/htdocs"
server.upload-dirs = ( temp_dir )
index-file.names =
( "index.php", "index.pl", "index.cgi", "index.cml",
"index.html", "index.htm", "default.htm" )
server.event-handler = "libev"
url.access-deny = ( "~", ".inc" )
$HTTP["url"] =~ "\.pdf$" {
server.range-requests = "disable"
}
static-file.exclude-extensions = ( ".php", ".pl", ".cgi" )
dir-listing.activate = "enable"
debug.log-file-not-found = "enable"
fastcgi.server = (
## The script name of the application
"/hello" => ((
## Command line to run
"bin-path" => "c:/apps/vcApps/cppCms/Release/hello -c
c:/apps/vcApps/cppCms/Release/configLH.js",
"host" => "127.0.0.1",
"port" => 80,
"max-procs" => 1,
"check-local" => "disable"
))
)
=========================================================================
When I invoke the lighttpd from DOS cmd I get the next results:
:lighttpd -D -f lighttpd.conf
2013-06-22 19:24:43: (log.c.166) server started
2013-06-22 19:24:43: (mod_fastcgi.c.1365) --- fastcgi spawning local
proc: c:/apps/vcApps/cppCms/Release/hello -c
c:/apps/vcApps/cppCms/Relea
se/configLH.js
port: 80
socket
max-procs: 1
2013-06-22 19:24:43: (mod_fastcgi.c.1389) --- fastcgi spawning
port: 80
socket
current: 0 / 1
========================================================================
Then I type the next in the IE browser:
http://localhost/hello
while I am waiting for an answer, the next message shows in the dos cmd
(look at the time elapsed):
2013-06-22 19:26:08: (mod_fastcgi.c.3035) got proc: pid: 0 socket:
tcp:127.0.0.1
:80 load: 1
2013-06-22 19:27:09: (mod_fastcgi.c.2543) unexpected end-of-file (perhaps
the fa
stcgi process died): pid: 0 socket: tcp:127.0.0.1:80
2013-06-22 19:27:09: (mod_fastcgi.c.3329) response not received, request
sent: 7
22 on socket: tcp:127.0.0.1:80 for /hello?, closing connection
2013-06-22 19:27:09: (mod_fastcgi.c.1490) released proc: pid: 0 socket:
tcp:127.
0.0.1:80 load: 0
Immediately after, the error HTTP 500 displays on IE browser.
=========================================================================
What do you think is wrong here? Can you suggest me any workaround?
Thanks for your time and attention.
Kind regards.
|