Main  /  Edit version 7  /  Edit version 8  /   /  Users Area

Difference "How to run the application at the root of the web server" ver. 7 versus ver. 8

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.
# 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
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
## lighttpd
Use the option url.rewrite-[repeat-]if-not-file
Or probably use rules like
The rewrite configuration looks like:
url.rewrite-once = (
"^/media/" => "$0",
"^/(.*)" => "/my.fcgi/$1"
"^(/media/.*)" => "$1",
"^/(.*)" => "/mb.fcgi/$1"
)
See: http://redmine.lighttpd.net/wiki/1/Docs:ModRewrite
fastcgi.server = ( "/mb.fcgi" => ( "localhost" => (
"check-local" => "disable",
"host" => "127.0.0.1",
"port" => 8081
)))
See: http://www.djangobook.com/en/beta/chapter21/#cn124
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