分类: BSD
2010-07-22 17:37:32
其实安装方法在官方的wiki就可找到,详细:
1.$ cd /usr/ports/lang/php5
# make install clean
按回车的时候,
选择 [X] FASTCGI Enable fastcgi support (CGI only)
Be sure to check the "use as FastCGI" option in the configuration screen. If you don't see the configuration screen, you're either using an old version of ports tree, or need to execute "make config". If you're using PHP 4 or an early version of PHP 5, you may have to use www/php4-cgi or a similar port instead of the new master port.
2 安装lighttpd
cd /usr/ports/www/lighttpd/
make install clean
按回车的时候,选择
[X] OPENSSL Enable SSL support
其他选项,看个人需要。
3.由于lighttpd的配置文件/usr/local/etc/lighttpd.conf很直观,仔细看下,基本的选项还是比较容易理解。现在只需要搞几个地方就可以整合php了。
以下2步就可以做一个简单的步骤,就可以搭设成php环境:
(1)在/usr/local/etc/lighttpd.conf 里找到server.modules里的"mod_fastcgi",把"#"注释去掉.
server.modules = ( |
(2)接下来找到fastcgi.server ,把socket 和bin-path两项参数写好:
fastcgi.server = ( ".php" => |
由于socket文件不存在,所以你需要mkdir /var/run/lighttpd; touch /var/run/lighttpd/php-fastcgi.socket; chown www:www /var/run/lighttpd/php-fastcgi.socket .
(3)## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
把cgi.fix_pathinfo = 1 写如php.ini (去掉注释,改为1就可以了)
现在可以启动lighttpd了,但是由于没有以下文件,所以还需要建立2个文件,且修改权限。
touch /var/log/lighttpd.error.log
touch /var/log/lighttpd.access.log
chown www:www /var/log/lighttpd.*
设置SSL支持
创建证书
cd /etc/ssl/private/
#openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
4.5.2 打开SSL支持
#### SSL engine
ssl.engine = “enable”
ssl.pemfile = “/opt/etc/server.pem”
设置自动启动
vi /etc/rc.conf
lighttpd_enable=”YES”
5.2 手工启动
/usr/local/etc/rc.d/lighttpd.sh start
注意,如果没有在/etc/rc.conf添加 /etc/rc.conf ,是不能启动的。所以需要先添加。