lightd+php+mysql

1 安装MySQL
这里是自己使用源码编译安装。
需要下载MySQL-4.0.25源码包。
cd /opt/distfiles
wget xxx
tar -zxvf mysql-4.0.25.tar.gz -C src
cd src/mysql-4.0.25/
./configure �Cprefix=/opt/modules/mysql
�Cenable-assembler
�Cwith-mysqld-ldflags=-all-static
�Cwith-charset=gb2312
�Cwithout-debug
make
make install
/opt/modules/mysql/bin/mysql_install_db
chown -R mysql.mysql /opt/modules/mysql/var
chgrp mysql /opt/modules/mysql
2 安装PHP
./configure
�Cprefix=/opt/modules/phpcgi
�Cenable-fastcgi
�Cenable-force-cgi-redirect
�Cenable-bcmath
�Cenable-inline-optimization
�Cenable-magic-quotes
�Cenable-wddx�Cdisable-debug
�Cenable-sysvmsg
�Cenable-sockets
�Cenable-mbstring
�Cenable-calendar
�Cwith-trans-sid
�Cwith-ldap
�Cwith-ldap-sasl
�Cwith-mysql=/opt/modulels/mysql
3 安装lighttpd
cd /usr/ports/www/lighttpd/
make install clean
执行后,将会提示一些选项只要选中OPENSSL 就可以了,其他的不用选。
4 整合配置
4.1 修改默认网站文件路径
server.document-root = “/opt/data/www/”
4.2 打开fastcgi模块支持
将 #”mod_fastcgi”, 的#去掉
4.3 设定PHP支持
#### fastcgi module
## read fastcgi.txt for more info
fastcgi.server = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/opt/modules/phpcgi/bin/php”,
# 如果你的网站很繁忙,可以加入如下设置
#”bin-environment” => (
# “PHP_FCGI_CHILDREN” => “16″,
# “PHP_FCGI_MAX_REQUESTS” => “10000″
#)
#”bin-path” => “/usr/local/bin/php”
)))
4.4 创建日志文件及设置权限
touch /var/log/lighttpd.error.log
touch /var/log/lighttpd.access.log
chown www:www /var/log/lighttpd.*
4.5 设置SSL支持
4.5.1 创建证书
cd /opt/etc/
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”
4.6 设置监听端口
默认的监听端口是 80,如果需要更改端口,可以修改配置设定。
## bind to port (default: 80)
#server.port = 81
5 启动
5.1 设置自动启动
vi /etc/rc.conf
lighttpd_enable=”YES”
5.2 手工启动
/usr/local/etc/rc.d/lighttpd.sh start
注意,如果没有在/etc/rc.conf添加 /etc/rc.conf ,是不能启动的。所以需要先添加。

你可能感兴趣的:(mysql,数据库,职场,休闲)