Fastcgi Container: a framework for development of high performance web applications in C++
Fastcgi Container is a framework for development of high performance web applications in C++.
Fastcgi Container is a branch of Yandex’s Fastcgi Daemon.
What’s new compared to Fastcgi Daemon:
All filters (including authentication/authorization filter) are executed under the FastCGI role “RESPONDER” and do not require that the roles “FILTER” and/or “AUTHORIZER” are supported by FastCGI connector (e.g. corresponding modules for Apache HTTPD).
Session manager and security facility (support for authentication and authorization) are implemented as an optional pluggable modules: you may load them to your application and use it, or run the application without these features.
Note that form-based authentication depends on session management: if you decide to use form-based authentication, you have to activate the session management as well.
LGPL v.3.0, except Page Compiler which is covered by GPL v.3.0.
Make sure the MNMLSTC Core is available in your INCLUDE path (for example, in /usr/include
or /usr/local/include
). It should resolve properly the header files with prefix core/
like:
#include "core/any.hpp"
To build the project you will need to have CMake installed appropriately in your system.
Inside the project directory, execute the following commands to generate Makefiles, build, and install the Fastcgi Container:
cmake .
make
sudo make install
If your default compiler does not meet the minimum feature set required to build the package, you may specify alternative compiler as follows:
cmake -DCMAKE_CXX_COMPILER=g++-4.9 .
make
sudo make install
In default configuration, the package will be installed with prefix /usr
. If you want to change the prefix, you may specify it as follows:
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local .
make
sudo make install
or
cmake -DCMAKE_INSTALL_PREFIX:PATH=~/bin/fastcgi-container .
make
make install go
For more information about CMake options see the documentation available on official CMake site.
After installation of the package in system directories /usr
or /usr/local
, create the necessary links and cache for use by the run-time linker:
sudo ldconfig
The following examples are provided:
All examples except C++ server page are built together with the Fastcgi Container.
To re-build them separately, execute the following commands:
cd ./example/pages
make
Copy built shared libraries from example/.libs
as well as configuration file example/fastcgi.conf
into working directory (e.g. ~/tmp/fscgi
). Modify configuration file as appropriate.
Configure available HTTPD server to connect with Fastcgi Container.
For example, to run examples via Unix socket with Apache2 HTTPD using modules mod_poxy
and mod_proxy_fcgi
, add the following entries into Apache configuration file:
ProxyPass /myapp/ unix:///tmp/fastcgi3-container-example.sock|fcgi://localhost/
To run examples via tcp socket, add the following entries into Apache configuration file:
ProxyPass /myapp/ fcgi://localhost:8080/
If you want to run examples in clustered environment, enable the Apache module mod_proxy_balancer
and add the following entries into Apache configuration:
ProxyPass /myapp/ balancer://myappcluster/ stickysession=JSESSIONID|jsessionid
<Proxy balancer://myappcluster/>
BalancerMember fcgi://localhost:8080
BalancerMember fcgi://localhost:8081
</Proxy>
Note that you will need to configure two or more instances of Fastcgi Container either on different hosts or on the same host with different ports.
For more information, see Apache documentation:
To run examples via Unix socket with NGINX server using module ngx_http_fastcgi_module
, add the following entries into NGINX configuration file:
location /myapp/ {
fastcgi_pass unix:/tmp/fastcgi3-container-example.sock;
include fastcgi_params;
}
You may also run examples in clustered environment.
For more information, see NGINX doumentation:
Start HTTPD server as appropriate (e.g. sudo /etc/init.d/apache start
).
Start Fastcgi Container with exmple configuration (here the container is started under the current user; in production start it as appropriate):
cd ~/tmp/fscgi
fastcgi3-domain --config=./fastcgi.conf
Open any web browser and type the following address in URL bar:
http://127.0.0.1/myapp/servlet
or
http://127.0.0.1/myapp/myapp/test?a1=22