¦´NÅ¥»¡lighttpd¥[PHPªºFAST-CGI¤è¦¡©Ê¯à¤£¿ù,©â®É¶¡¸Ë¤F¤U.¥u¬O§¹¦¨¤FÀô¹Òªº¦w¸Ë,ÁÙ¨S¨ãÅé¬Ý©Ê¯à¤°»òªº!
¥H¤U¬O§Ú¸Ëlighttpd+PHP(FAST-CGI)+mysqlªº¡A¦p¦³°ÝÃD¡A½Ðµ¹§Úµû½×.
¤@¡B¥ý¦w¸ËMySQL
¦w¸Ëmysql¡A§A¥i¥H¦w¸Ë·½½X¥]¡A¤]¥i¥H¥Î½sͦnªº¡Iª½±µ¸ÑÀ£«þ¨©¤]¦æ.§Ú¥Îªº¬Oª½±µ«þ¨©½sͦnªº¡I
1.½sĶ·½½X¥]
./configure --prefix=/data2/ali --enable-assembler --enable-thread-safe-client --without-debug
make
make install
2.¥Î½sͦnªºÀ£ÁY¥]¡Iª½±µ¸ÑÀ£«þ¨©
tar zxf mysql-standard-5.0.27-linux-i686-glibc23.tar.gz
cd mysql-standard-5.0.27-linux-i686-glibc23
cp -rf mysql-standard-5.0.27-linux-i686-glibc23 /usr/local/mysql
//¥H¤U¬O¬°¤F±Ò°Ê¦hӺݤf
mkdir -p /data2/ali/mysql3308
mkdir -p /data2/ali/mysql3309
./scripts/mysql_install_db --ldata=/data2/ali/mysql3308
cp support-files/my-medium.cnf /data2/ali/mysql3308/my.cnf
vi /data2/ali/mysql3308/my.cnf
ק鷺®e¦p¤U:
#
[mysqld]
datadir = /data2/ali/mysql3308/
port = 3308
socket = /tmp/mysql-3308.sock
#
cp /data2/ali/mysql3308/ /data2/ali/mysql3309/
vi /data2/ali/mysql3309/my.cnf
ק鷺®e¦p¤U:
#
[mysqld]
datadir = /data2/ali/mysql3309/
port = 3309
socket = /tmp/mysql-3309.sock
#
±Ò°Êmysql
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data2/ali/mysql3308/my.cnf --user=root &
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data2/ali/mysql3309/my.cnf --user=root &
Àˬdmysql¬O§_±Ò°Ê¦¨¥\¡C
ps -ax|grep mysql
20835 pts/3 S 0:00 /bin/sh ./mysqld_safe --defaults-file=/data2/ali/mysql3308/my.cnf --user=root
20862 pts/3 Sl 0:00 /usr/local/mysql/bin/mysqld --defaults-file=/data2/ali/mysql3308/my.cnf --basedir=/usr/local/mysql --datadir=/data2/ali/mysql3308/ --user=root --pid-file=/data2/ali/mysql3308//XD_Blog_Web_132_42.pid --skip-external-locking --port=3308 --socket=/tmp/mysql-3308.sock
20872 pts/3 S 0:00 /bin/sh ./mysqld_safe --defaults-file=/data2/ali/mysql3309/my.cnf --user=root
20903 pts/3 Sl 0:00 /usr/local/mysql/bin/mysqld --defaults-file=/data2/ali/mysql3309/my.cnf --basedir=/usr/local/mysql --datadir=/data2/ali/mysql3309/ --user=root --pid-file=/data2/ali/mysql3309//XD_Blog_Web_132_42.pid --skip-external-locking --port=3309 --socket=/tmp/mysql-3309.sock
³s±µmysql
mysql -S /tmp/mysql-3108.sock
¤G¡B±µµÛ¦w¸Ëphp
tar zxf php-5.2.4.tar.gz
cd php-5.2.4
./configure \
--prefix=/usr/local/php-fcgi \
--enable-fastcgi \
--enable-force-cgi-redirect \
--without-iconv \
--enable-mbstring \
--with-mysql=/usr/local/mysql
make
make install
½Æ»s°Ñ¼Æ¤å¥ó¨ì¥Ø¼Ð¥Ø¿ý:
cp php.ini-dist /usr/local/php-fcgi/lib/php.ini
Àˬdfast-cgi¬O§_¦w¸Ë¦¨¥\¥i¥H¹B¦æ¦p¤U©R¥O
/usr/local/php-fcgi/bin/php-cgi -v
Åã¥Ü¦p¤U¸ê°T¡A¤º®eùØ¥]§t¡§PHP 5.2.4 (cgi-fcgi)"ªí¥Ü¤ä´©fast-cgi¤F
PHP 5.2.4 (cgi-fcgi) (built: Oct 28 2007 20:08:41)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
¤T¡B³Ì«á¦w¸Ëlighttpd
1.¦w¸Ë°t¸mlighttpd
1.1 º¥ý³Ð«Ø¹B¦ælighttpdªº¥Î¤á©M²Õ
# groupadd lighttpd
# useradd -g lighttpd -s /sbin/nologin -d /dev/null lighttpd
1.2 ¶}©l¦w¸Ëlighttpd
# wget http://www.lighttpd.net/download/lighttpd-1.4.8.tar.gz
# tar -zxvf lighttpd-1.4.8.tar.gz
# cd lighttpd-1.4.8
# ./configure --prefix=/usr/local/lighttpd
# make
# make install
# mkdir /usr/local/lighttpd/conf
# mkdir /usr/local/lighttpd/log
# mv ./doc/lighttpd.conf /usr/local/lighttpd/conf/
# cp ./doc/rc.lighttpd.redhat /etc/init.d/lighttpd
vi conf/lighttpd.conf
±N #¡¨mod_fastcgi¡¨, ªº#¥h±¼
server.modules = (
"mod_rewrite",
"mod_redirect",
# "mod_alias",
"mod_access",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
"mod_fastcgi",
§ä¨ìfastcgiªº©w¸q
#### 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/php-fcgi/bin/php-cgi"
)
)
)
¤@¶}©l§Ú§â°t¸m¼g"bin-path" => "/usr/local/php-fcgi/bin/php"³o¼Ë¡Aµo²{³ø¿ù¡A«á¨Ó§ï¤F¤U¥H¤Wªº°t¸m¡Aµo²{OK¤F¡I
±Ò°Êlighttpd©R¥O¬O³o¼Ëªº¡G
/usr/local/lighttpd/sbin/lighttpd -f conf/lighttpd.conf
³Ì«á¥i¥H¦bµ{¦¡¥Ø¿ý¤U«ØÓtest.php,Àˬd¤@¤U¬O§_¥¿±`!
¡]³d¥ô½s¿è¡G¿c¥üªL¡^