<!--toc--> |
|
Most of the time, one would want to run the cppcms application so that accessing the root of the web server (the root of your domain name) would display the root content of your application. |
|
However, the simplest set up requires the required path to be prefixed by the application name, which is not usually pretty. The fix requires to set up the web server with some URL rewriting mechanism. The exact set up depends on the web server used. |
|
# NOTE! |
## NOTE! |
|
Remember that the content of the wiki is contributed by CPPCMS community members. If you find inaccuracies in the instructions provided below, please register/login and edit the page for the benefit of future users. |
|
# Apache2 |
## Apache2 |
|
Use mod_rewrite. |
|
.htaccess: |
|
<IfModule mod_rewrite.c> |
RewriteEngine on |
|
RewriteCond %{REQUEST_FILENAME} !-f |
RewriteCond %{REQUEST_FILENAME} !-d |
RewriteRule ^(.*)$ my_app.cgi/$1 [L,QSA] |
</IfModule> |
|
|
Of course, Apache2 must be properly configured to allow .htaccess override of mod_rewrite. |
|
|
Or use a script alias: |
|
# Content of /etc/apache2/sites-enabled/tatoebacpp |
|
FastCGIConfig -maxProcesses 1 -processSlack 1 |
<VirtualHost *:80> |
|
ServerName tato.sysko.fr |
ServerAlias *.tato.sysko.fr |
|
# Usually it is given in fastcgi.conf by default |
|
FastCgiServer /blablabla/tatoebacpp_git/build/tatoeba -initial-env CPPCMS_CONFIG=/blablabla/tatoebacpp_git/config.js -socket /tmp/hello-fcgi-socket |
|
ScriptAliasMatch ^(.*)$ /blablabla/tatoebacpp_git/build/tatoeba$1 |
|
|
AddHandler fastcgi-script /blablabla/tatoebacpp_git/build/tatoeba |
|
</VirtualHost> |
|
## lighttpd |
|
The rewrite configuration looks like: |
|
url.rewrite-once = ( |
"^(/media/.*)" => "$1", |
"^/(.*)" => "/mb.fcgi/$1" |
) |
|
fastcgi.server = ( "/mb.fcgi" => ( "localhost" => ( |
"check-local" => "disable", |
"host" => "127.0.0.1", |
"port" => 8081 |
))) |
|
|
See: <http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite> |
## nginx |
|
See: <http://www.djangobook.com/en/beta/chapter21/#cn124> |
The rewrite rule is: |
|
|
rewrite ^(/media/.*)$ $1 last; |
rewrite ^/(.*)$ /mb.fcgi/$1 ; |
|
## Sources |
|
|
- <http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite> |
- <http://www.djangobook.com/en/beta/chapter21/#cn124> |
|
|
|