
page74010-chrk at yahoo
May 1, 2013, 8:05 AM
Post #5 of 5
(258 views)
Permalink
|
|
Re: Migration from Apache to Cherokee: URI tweaking
[In reply to]
|
|
I tried both "internal" and "external" with the same effect. "external" has the debugging advantage to show the result of substitution. Nginx and lighttpd are based on original concepts, different from Apache. * lightpd: You regexp-match on the URL and you tell that such initial URL part is related to such document root, e.g.: $HTTP["url"] =~ "^/LXR_signature/" { alias.url += ( "/LXR_signature/DB_id" => "common_LXR_root_directory" ) } and there is another directive to name the files which are scripts. *nginx: There is no notion of "master" DocumentRoot and Alias as in Apache. Every URL can be individually diverted to its own root. Of course in the simplest case, this is equivalent to DocumentRoot or Cherokee's directory rule or default rule. Part of an URL is regexp-matched by a location directive and you tell what you want to do with the bits without rewrite, e.g.: server { ... location ~ ^/LXR_signature/[^/]+(.*)$ { alias /LXR_root_directory/$1 ; # for ordinary files like .css or images location ~ ^(/LXR_signature/[^/]+/)(script_names) { set $virtroot $1; set $scriptname $2; alias /LXR_root_directory; include fastcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$scriptname; # compute which script to launch fastcgi_param SCRIPT_NAME $virtroot$scriptname; # unaltered CGI variable fastcgi_pass unix://...; } } } My idea was to mimic nginx' "action" block. Unhappily, I could not fancy how to simultaneously "untweak" the initial URL part and launch the correct script. I had to break it into two separate rules. The first one identifies the LXR service and removes DB_id to provide an "ordinary" script path, but doing so I lose DB_id. The second one is a common directory rule with CGI handler, but since the URI has changed the called script fails because it takes a segment of the web directory as the DB_id. Anyway, considering the tweaks needed to port LXR on various web servers, I'm more and more convinced that putting the DB_id in the middle of the web directory name (exactly, just before the script name) was a bad design choice (but ages ago, you had Apache - full stop). That information belongs in the script parameters, maybe as a root for PATH_INFO. Notwithstanding the compatibility issue with existing LXR sites, redesigning this needs a lot of effort (first for a neat design, next in trying not to break the core code). Thus if you know the name of a Cherokee variable, like nginx' $originaluri, this could temporarily solve the problem. Thanks for your answers and your patience. ________________________________ De : Daniel Lo Nigro <lists [at] dan> À : Anfré Littoz <page74010-chrk [at] yahoo> Cc : cherokee List <Cherokee [at] lists> Envoyé le : Mercredi 1 mai 2013 15h03 Objet : Re: [Cherokee] Migration from Apache to Cherokee: URI tweaking Hmm I thought rewrite rules shouldn't change the URI if they're marked as "internal". Does LXR have instructions for Nginx or Lighttpd? If so, you should be able to convert those rules to Cherokee rules. Apache has so many configuration options that sometimes it's hard to find the exact match.
|