JuxtaPhoto on Lighttpd
cause my system admin change the web server from Apache to Lighttpd for better performance, i found my JuxtaPhoto be out of functional.
cause i do not have much time on this issue, maybe there has another better way to solve. but my way works well.
JuxtaPhoto use URL Rewrite to deal the http request and the parameters, make the way easier for MVC work flow and SEO.
So, a file named .htaccess can be found in your photos directory , it looks like:
<IfModule mod_rewrite.c>
RewriteEngine On
# The line below may need to be uncommented and modified if you use a Server Alias
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php [QSA]
</IfModule>
you do not need to understand that, all the text means forwards some httpd requests to index.php
the key problem is the url rewrite way is different between Apache and Lighttpd , you have to adjust some lighttpd.conf conditions.
1, you cannot use .htaccess file
Lighttpd does not have AccessFile funciton, you have to write the rules in lighttpd.conf, see following
2, Mod_Redirect syntax is different
that means, we have to rewrite the rules in lighttpd.conf
lighttpd mod_rewrite does not support -f and -d condition, and i try to use negative condition in regular express, failed (why? looks lighttpd has another way.)
so, i write a condition looks a little longer (but easy and clean), copy the following rules and paste to your virtual host place in lighttpd.conf, restart web server , and check out.
url.rewrite = ("^/photos/(album|date|default|detail|download|feed|fileupload|imagetags|installer|installer_gb|organize|previewalbum|slideshow|tags|tagsuggest|upgrade|view)(.*)$" => "/photos/index.php/$1$2")
在Lighttpd上使用JuxtaPhoto
由于我的系统管理员使用 Lighttpd 替换了 Apache, 原来的 JuxtaPhoto 无法工作了,只好研究一下了。
由于时间不多, 匆忙一看,可能还有更好的方法解决这个问题,但是我的相册目前工作很正常,大家可以去
http://www.guojiele.com/photos 看一下。
JuxtaPhoto 使用 URL 重定向处理 http 请求,主要是为了 MVC 控制和比较好的 SEO效果。
你可以在相册的目录下发现 .htaccess 文件, 内容是:
<IfModule mod_rewrite.c>
RewriteEngine On
# The line below may need to be uncommented and modified if you use a Server Alias
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [PT,L]
RewriteRule ^(.*) index.php [QSA]
</IfModule>
这意味着把一些特定的请求和参数转给 index.php 处理。
由于 Apache 和 Lighttpd 对 URL 重定向的处理不同, 所以我们必须调整相关的规则。
1, 不能使用 .htaccess 文件
Lighttpd 不支持 AccessFile 所以需要把规则写进 lighttpd.conf 配置文件里
2, Mod_Redirect 语法不同
lighttpd mod_rewrite 不支持 -f -d 条件, 同时我试图在正则中使用否条件失败 (why? 似乎是lighttpd 对否条件处理的问题.)
所以我的规则写的有点麻烦(但不复杂),把下面内容拷贝到 lighttpd.conf 中你自己的虚机那部分, 然后重新启动 web 服务,试试看。
url.rewrite = ("^/photos/(album|date|default|detail|download|feed|fileupload|imagetags|installer|installer_gb|organize|previewalbum|slideshow|tags|tagsuggest|upgrade|view)(.*)$" => "/photos/index.php/$1$2")