Lighttpd安装使用笔记

2009-05-13 12:38:08来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

1.
[url=javascript:;]安装[/url]
# cd /build/ports/www/lighttpd
# make install clen
此时会出现一个模块选择框,根据自己的需要选择。
2. 设置配置文件
将目录”/usr/local/etc/”下的”lighttpd.conf.sample”复制为”lighttpd.conf”,给予”lighttpd.conf”文件写权限后使用编辑器打开它,进行如下设置:
开启模块
在”server.modules”段中打开以下模块:
mod_fastcgi
设置页面地址
设置”server.document-root”,修改默认的站点地址。
设置
[url=javascript:;]PHP[/url]
支持
将”fastcgi.server”段设置如下:
fastcgi.server = (
".php" => (
"localhost" => (
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)
2. 创建相关文件及目录
创建日志文件并设置权限:
touch /var/log/lighttpd.error.log
touch /var/log/lighttpd.access.log
chown www:www /var/log/lighttpd.*
创建PID文件存放目录并设置权限:
mkdir /var/run/lighttpd
chown www:www /var/run/lighttpd
3. 启动服务
使用以下命令临时启动服务:
/usr/local/etc/rc.d/lighttpd onestart
如果要在系统启动时自动启动服务,可以在”/etc/rc.conf”中添加以下语句:
lighttpd_enable="YES"
4. 配置Lighttpd支持php5
在FreeBSD下安装php5
cd /usr/ports/lang/php5
make config
选中 Build CGI version
装完后测试一下
/usr/local/bin/php-cgi -v
出现的信息中有个(cgi-fcgi)表示支持fast-cgi了
vi ighttpd.conf
将 #”mod_fastcgi”, 的#去掉
配置fastcgi的定义
#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)
重启lighttpd,测试一下吧。
5.配置Lighttpd支持Symfony
在每个虚拟主机的配置文件里添加重写规则:
alias.url = (
"/sf" => "/usr/share/php/data/symfony/web/sf"
)
url.rewrite-once = (
"^/(.*\..+(?!html))$" => "$0",
"^/(.*)\.(.*)" => "$0",
"^/([^.]+)$" => "/index.php/$1",
"^/$" => "/index.php"
)
6.配置Lighttpd下的虚拟主机
在 server.modules 部分将以下几个模块前的注释去掉:
mod_simple_vhost
这里将配置以下几个虚拟主机:
www.liumin.name
www.zzxxw.net
对应的目录分别为:
# For
[url=javascript:;]virtual[/url]
host:
www.liumin.name
/var/www/lighttpd/vhosts/liumin.name/

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:OpenVPN 2.0 HOWTO-基本配置篇(翻译)

下一篇:squid 安装调试过程中的几个常用命令