升级到lighttpd 1.4.28-1碰到的问题

昨天在VPS上执行apt-get update,apt-get upgrade 升级时,在提示是否替换lighttpd的配置时全选yes后,出现所有网站无法访问,报403错误的问题。

检查lighttpd替换的配置,发现/etc/lighttpd/conf-available/fastcgi.conf 少了.php文件的部分。在新的配置文件里加入如下内容:

fastcgi.server    = ( “.php” =>
((
“bin-path” => “/usr/bin/php5-cgi”,
“socket” => “/tmp/php.socket”,
“max-procs” => 2,
“idle-timeout” => 20,
“bin-environment” => (
“PHP_FCGI_CHILDREN” => “4”,
“PHP_FCGI_MAX_REQUESTS” => “10000”
),
“bin-copy-environment” => (
“PATH”, “SHELL”, “USER”
),
“broken-scriptfilename” => “enable”
))
)

重启lighttpd后,故障排除。

Lighttpd 压缩及过期设置(Linode Debian VPS)

我在Linode Debian VPS上使用的compress和expire设置。

1.Lighttpd的compress设置

实现对网站相关元素在网站传输前的压缩,节约传输流量,并加快用户的访问速度。

compress.cache-dir = “/home/lighttpd/compress/”
compress.filetype= (“text/plain”, “text/html”, “application/x-javascript”,”application/javascript”,”text/css”,”text/javascript”,”image/gif”, “image/png”,”image/jpg”,”image/jpeg”)

2.Lighttpd的expire设置

实现对网站不常变化相关元素的客户端浏览器缓存(我设置的是两个月),减少每次和网站之间的传输流量,提高用户的访问速度。

$HTTP[“url”] =~ “\.(gif|png|jpg|ico|css|js)(\?(.*))?$” {
expire.url = ( “” => “access 2 months” )
}

 

PS:如果你觉得Linode VPS不错,可以点击这里Linode VPS购买链接直接购买,你购买后我会得到一点返利。

Lighttpd WordPress Rewrite(Linode Debian VPS)

在配置Linode Debian VPS中使用到的WordPress网页地址重写规则。

1.lighttpd的wordpress mu的子域名方式地址重写

$HTTP[“host”] =~ “it580\.com” {
simple-vhost.default-host = “it580.com”
server.error-handler-404 = “/index.php”
url.rewrite-once = (
“^/(.*/)?files/$” => “/index.php”,
“^/(.*/)?files/(.*)” => “/wp-content/blogs.php?file=$2”,
“^(/wp-admin/.*)” => “$1”,
“^/([_0-9a-zA-Z-]+/)?(wp-.*)” => “/$2”,
“^/([_0-9a-zA-Z-]+/)?(.*\.php)$” => “/$2”,
)

}

2.lighttpd的wordpress的地址重写

$HTTP[“host”] == “cindywm.com” {
server.name = “cindywm.com”
url.rewrite-final = (
“^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)” => “$0”,
“^/(.*.php)” => “$0”,
“^/(.*)$” => “/index.php/$1”
)
}

PS:如果你觉得Linode VPS不错,可以点击这里Linode VPS购买链接直接购买,你购买后我会得到一点返利。

试用Lighttpd

关键字:Lighttpd Webserver 安装

Lighttpd介绍:

Security, speed, compliance, and flexibility–all of these describe LightTPD which is rapidly redefining efficiency of a webserver; as it is designed and optimized for high performance environments. With a small memory footprint compared to other web-servers, effective management of the cpu-load, and advanced feature set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) LightTPD is the perfect solution for every server that is suffering load problems. And best of all it’s Open Source licensed under the revised BSD license.

“lightTPD is the BEST webserver out there, much faster than apache and much much much more flexible/configurable/secure than tux, and its fcgi php support is simply unbeatable.”
– Viktors Rotanovs

简单安装:
1.到http://www.lighttpd.net/download/下载最新的源代码版本,文件类似于lighttpd-1.4.3.tar.gz。

2.解压缩文件 tar -xzvf lighttpd-1.4.3.tar.gz

3.编译参数:

./configure –prefix=/usr/local/lighttpd-1.4.3
make
make install

4.配置

cp /usr/local/src/lighttpd-1.4.3/doc/lighttpd.conf /usr/local/lighttpd-1.4.3
cd /usr/local/lighttpd-1.4.3/sbin/
./lighttpd -f ../lighttpd.conf -t
(如果显示Syntax OK,就ok了,否则请检查lighttpd.conf)

5.完成并启动

./lighttpd -f ../lighttpd.conf