Linux / UNIX Tech Support Forum
This is a discussion on Drupal/lua rules for lighttpd within the Web servers forums, part of the Mastering Servers category; Hi .. can someone with expertise in lighty rules please help..I am using Drupal CMS on a LLMP stack and ...
|
|||||||
| Web servers Discussion on Apache, Nginx and Lighttpd HTTP/web server and configuration issues. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi .. can someone with expertise in lighty rules please help..I am using Drupal CMS on a LLMP stack and I am stuck on trying
to come up with rules for a particular module I am wanting to use. In lighttpd.conf I have: ======================== $HTTP["host"] =~ "(^|\.)mydomain\.com" { server.document-root = "/var/www/public_html/mydomain.com/" index-file.names = ( "index.php" ) # for clean urls magnet.attract-physical-path-to = ("/etc/lighttpd/rewrite_drupal.lua") } In rewrite_drupal.lua I have: ============================== -- little helper function function file_exists(path) local attr = lighty.stat(path) if (attr) then return true else return false end end function removePrefix(str, prefix) return str:sub(1,#prefix+1) == prefix.."/" and str:sub(#prefix+2) end -- prefix without the trailing slash -- If reverting back to production mode comment in the above line and uncomment the line below local prefix = '' -- the magic if (not file_exists(lighty.env["physical.path"])) then -- file still missing. pass it to the fastcgi backend request_uri = removePrefix(lighty.env["uri.path"], prefix) if request_uri then lighty.env["uri.path"] = prefix .. "/index.php" local uriquery = lighty.env["uri.query"] or "" lighty.env["uri.query"] = uriquery .. (uriquery ~= "" and "&" or "") .. "q=" .. request_uri lighty.env["physical.rel-path"] = lighty.env["uri.path"] lighty.env["request.orig-uri"] = lighty.env["request.uri"] lighty.env["physical.path"] = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"] end end -- fallthrough will put it back into the lighty request loop -- that means we get the 304 handling for free. ---------------------------------------------------------------------------------- Given the above here is my question : I want to know how to enable the following rules for a drupal module called "boost" which tries to serve cached html pages bypassing php/drupal and the database. There is a write-up on this at: Boost your Drupal site! | Code Sorcery Workshop Now for this Drupal module to work, there are rewrite rules needed. Currently the module author has noly provided htaccess rules for Apache. I need lighttpd rules. I have pasted above the rules I currently have in lighttpd.conf and rewrite_drupal.lua file. Can someone pls help me with the rules to add to the lua or the lighttpd.conf file to make this module work. I am pasting below the htaccess rules specific to this module that the author is recommending. If anyone has any suggestions on how it can work with lighttpd that would be a big help. # Apache htaccess Rewrite rules for static page caching provided by the Boost module: # BOOST START <IfModule mod_headers.c> Header add Expires "Sun, 19 Nov 1978 05:00:00 GMT" Header add Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0" </IfModule> <IfModule mod_mime.c> AddCharset utf-8 .html </IfModule> RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{REQUEST_URI} ^/$ RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/index.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/index.html [L] RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{REQUEST_URI} !^/cache RewriteCond %{REQUEST_URI} !^/user/login RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI} -d RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}/index.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L] RewriteCond %{REQUEST_METHOD} ^GET$ RewriteCond %{REQUEST_URI} !^/cache RewriteCond %{REQUEST_URI} !^/user/login RewriteCond %{REQUEST_URI} !^/admin RewriteCond %{QUERY_STRING} ^$ RewriteCond %{HTTP_COOKIE} !DRUPAL_UID RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}.html -f RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L] # BOOST END # Rewrite current-style URLs of the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] </IfModule> |
| Sponsored Links | ||
|
|
|
|||
|
Figured it out . Check my(drupdrips)s)s) post at
Lighttpd rewrite rules wanted | drupal.org I 'd appreciate any suggestions on improving it for functionality and performance. Last edited by jtrudeau; 07-09-2008 at 12:21 AM. Reason: typo |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to make iptable rules? | saroj | Networking, Firewalls and Security | 7 | 11-03-2009 06:18 PM |
| Lighttpd Gallery2 URL Rewrite (.htaccess) SEO Rules | rootadmin | Web servers | 2 | 22-06-2008 06:57 PM |
| iptables rules blocking ftp | hammooda | Linux software | 7 | 23-09-2006 04:24 PM |
| iptables rules for three ethernet | brijeshchougule | Linux software | 2 | 16-06-2005 02:42 PM |
| Forum rules | vivek | Feedback & Site News | 0 | 01-02-2005 11:04 AM |