Main  /  Edit version 4  /  Edit version 5  /   /  Users Area

Difference "How to run the application at the root of the web server" ver. 4 versus ver. 5

Content:

<!--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.
# 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
Use the option url.rewrite-[repeat-]if-not-file
Or probably use rules like
url.rewrite-once = (
"^/media/" => "$0",
"^/(.*)" => "/my.fcgi/$1"
)
See: http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite
See: http://www.djangobook.com/en/beta/chapter21/#cn124

About

CppCMS is a web development framework for performance demanding applications.

Support This Project

SourceForge.net Logo

Поддержать проект

CppCMS needs You


Navigation

Main Page


Valid CSS | Valid XHTML 1.0