转移主机,使用了自己搭建的系统,响应速度方面Lighttpd口碑不错,决定使用 Lighttpd来构建新的主机。
安装完一基本的debian系统之后,先做一下系统升级。使用命令:
aptitude update
aptitude upgrade
然后开始安装Lighttpd,php5,mysql,这里参考了文章:
Installing Lighttpd With PHP5 And MySQL Support On Debian Etch
Lighttpd是一个安全,快速,标准兼容的Web伺服器,速度是其关键优点 ,因此适合对速度要求较高的场合。本教程介绍如何在Debian上安装lighttpd,安装并整合php5(通过fastcgi )和MySQL。
1、参数准备
这里主机域名以www.nufang.info为例,假设ip为192.168.1.6。
2、首先安装Lighttpd。
aptitude install lighttpd
系统会自动下载并安装lighttpd,并自动启动。
安装完毕,我们通过查看192.168.1.6可以看到下面的页面,表示lighttpd已经正常运行起来了。
默认情况下lighttpd的网页根目录和apache一样是/var/www,配置文件放在/etc/lighttpd/lighttpd.conf
3、安装php
lighttpd支持php使用的是cgi的方式。因此这里我们安装php-cgi。
aptitude install php5-cgi
4、配置lighttpd来支持php
php的配置文件php.ini放在/etc/php/cgi目录。
vim /etc/php5/cgi/php.ini
然后找到cgi.fix_pathinfo,修改为:
cgi.fix_pathinfo = 1
lighttpd的配置文件目录(/etc/lighttpd)有两个目录:conf-available conf-enabled .
这里conf-available方的是可以使用的配置模板,conf-enabled是已经启动的配置。如果希望lighttpd加载某个模块,只要将conf-available中的配置copy到conf-enabled中即可。
ls /etc/lighttpd/conf-available/
我们看到显示结果是:
05-auth.conf 10-proxy.conf 10-ssi.conf 10-userdir.conf
10-cgi.conf 10-rrdtool.conf 10-ssl.conf README
10-fastcgi.conf 10-simple-vhost.conf 10-status.conf
察看fastcgi配置的内容
more /etc/lighttpd/conf-available/10-fastcgi.conf
内容如下:
## FastCGI programs have the same functionality as CGI programs,
## but are considerably faster through lower interpreter startup
## time and socketed communication
##
## [...]