Hello,
>
> Hello,
>
> What is the proper way to set up cppcms to run with fastcgi?
>
Every CGI/FastCGI/SCGI application regardless if they are CppCMS based or not
are run by web server and defined by special "script" path. For example
for PHP it may be /foo/bar.php for binary cgi scripts it would be
/cgi-bin/bar.cgi
So you need to provide a web server a path to run CGI application from.
Recommendation choose something like
/your_app_name
Next step is to decide whether web server is responsible on starting
your CppCMS application or you start your CppCMS application on your
own and just tell web server how to connect (apache, lighttpd support
both first and second case, nginx just second case).
If you want to know how to configure a web server in second case
the simplest way - use cppcms_run utility, it creates a configuration
file you should be based on.
It is very useful tool to run CppCMS applications against web server for
debugging.
For example in case of apache external start you may need something like that:
FastCgiIpcDir some/ipc/directory/generally/given/in/your/fastcgi/mod
FastCgiExternalServer /path/to/your/myapp.fcgi -socket
/tmp/cppcms_socket
ScriptAliasMatch ^/your_app_name(.*)$ /path/to/your/myapp.fcgi\$1
AddHandler fastcgi-script .fcgi
And then pass:
"api" : "fastcgi" , "socket" : "/tmp/cppcms_socket"
For case of apache staring the service you need to use
FastCgiServer instead of external one
and set server.socket = "stdin" see to take the socket from web server:
<http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config#service.socket>
(Actually I had forgot to add the stdin option to documentation)
See also reference: <http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html>
This reminds me that I need a section in wiki on how to configure CppCMS with
various
web servers.
> I have libapache2-mod-fastcgi installed.
>
>
> The problem with "api":"http" is that I have not found a way to configure it
>so
>
> that:
>
> 1- we can serve file (file_server = true, to serve .css files, etc).
> 2- there is no prefix (from the script) at the beginning of the URL.
>
> In the 'mb' example, all the url's are prefixed like this:
> url = request().script_name()+"/tree/"+lexical_cast<string>(id);
> where my code simply does the equivalent of:
> url = "/tree/"+lexical_cast<string>(id);
>
> http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_config
> I tried several combinations of:
> service.api
> http.script
> file_server.enable
> file_server.document_root
> but the only way I managed to make it work is when all the URL are prefixed
> with the script name.
>
Yes, fastcgi applications require some script name. And this is what you will
have with every
web server. You may probably use some URL rewriting or use several script names
to get different behavior.
In any case iternal server supports only this kind of behavior.
Regards,
Artyom
|