**Note:** _This example is related to "trunk" version of CppCMS that is still not released._ |
|
## Configuration File |
|
Every CppCMS based application should come with a configuration file. |
You can find a configuration file template with full comments in docs folder |
at your CppCMS installation. |
|
We will write a simple file that consists of few lines: |
|
server.api = "fastcgi" |
server.mod = "prefork" |
|
This will define a basic settings for the runtime mode: |
|
1. API that uses CppCMS in communication with web server, in our case "fastcgi". Other options are "scgi" and "cgi". |
2. Worker mode of CppCMS -- prefork -- application forks several processes that |
process queries. Other possible options are single process and thread mode -- "process" and single process multiple threads mode "thread". |
|
We would save it as "config.txt" |
|
## Web Server Configuration |
|
### Lighttpd |
|
Now we need to configure our web server to run our application. We would let lighttpd control processes start up and shout down. |
|
Thus we need add to lighttpd configuration file following: |
|
fastcgi.server = ( "/hello" => |
( "localhost" => |
( |
"check-local" => "disable", |
"max-procs" => 1, |
"bin-path" => "/path/to/hello.fcgi -c /path/to/config.txt", |
"socket" => "/tmp/hello-fastcgi.socket" |
) |
) |
) |
|
Where: |
|
- `/hello` is our path to the root of the application on the web site, for example for `www.site.com/hello` it is `/hello`. |
- `/path/to/config.txt` is the location of our configuration file that defines different CppCMS |
parameters we had prepared. For example: `/home/david/projects/hello/config.txt` |
- `/path/to/hello.fcgi` is the path to the location of fastcgi executable we |
compiled before. For example: `/home/david/projects/hello/hello.fcgi` |
|
Make sure, Lighttpd has permissions to run it. |
|
### Apache |
|
(TODO) |
|
## Running |
|
Now restart your web server, open a web browser and go to [http://localhost/hello](http://localhost/hello). You should see "Hello World" |
|