视频1 视频21 视频41 视频61 视频文章1 视频文章21 视频文章41 视频文章61 推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37 推荐39 推荐41 推荐43 推荐45 推荐47 推荐49 关键词1 关键词101 关键词201 关键词301 关键词401 关键词501 关键词601 关键词701 关键词801 关键词901 关键词1001 关键词1101 关键词1201 关键词1301 关键词1401 关键词1501 关键词1601 关键词1701 关键词1801 关键词1901 视频扩展1 视频扩展6 视频扩展11 视频扩展16 文章1 文章201 文章401 文章601 文章801 文章1001 资讯1 资讯501 资讯1001 资讯1501 标签1 标签501 标签1001 关键词1 关键词501 关键词1001 关键词1501 专题2001
Lighttpd+PHP-FastCGI+MySQL+eAccelerator安装
2020-11-09 13:16:47 责编:小采
文档


一、软件准备 ============ Lighttpd:?http://www.lighttpd.net PHP:?http://www.php.com MySQL:?http://www.mysql.com eAccelerator:?http://sourceforge.net/project/showfiles.php?group_id=122249 将这些软件都放到/usr/local/src Lighttpd依赖于pcre-de

一、软件准备
============
Lighttpd:?http://www.lighttpd.net
PHP:?http://www.php.com
MySQL:?http://www.mysql.com
eAccelerator:?http://sourceforge.net/project/showfiles.php?group_id=122249
将这些软件都放到/usr/local/src

Lighttpd依赖于pcre-devel包,如果没有安装请下载或者从光盘中安装。
二、安装MySQL
=============
# cd /usr/local/src
# rpm -Uvh MySQL-client-4.0.26-0.i386.rpm
# rpm -Uvh MySQL-server-4.0.26-0.i386.rpm
# mysqladmin -u root password “new_password_for_root”
# service mysql start
三、安装Lighttpd
================
# useradd lighttpd
# vi /etc/passwd (将lighttpd用户的登录shell改为/bin/nologin)
# cd /usr/local/src
# tar xzvf lighttpd-lighttpd-1.4.10.tar.gz
# cd lighttpd-lighttpd-1.4.10
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –prefix=/usr/local/lighttpd –with-bzip2 –disable-ipv6
# make
# make install
# mkdir /usr/local/lighttpd/conf
# mkdir /usr/local/lighttpd/log
# cp ./doc/lighttpd.conf /usr/local/lighttpd/conf/
# cp ./doc/rc.lighttpd.redhat /etc/rc.d/init.d/lighttpd
# chown root:root /etc/rc.d/init.d/lighttpd
# chmod 755 /etc/rc.d/init.d/lighttpd
# chkconfig –add lighttpd
# cp ./doc/spawn-php.sh /usr/local/lighttpd/bin/
# vi /usr/local/lighttpd/bin/spawn-php.sh

以下是spawn-php.sh需要修改的部分:
SPAWNFCGI=”/usr/local/lighttpd/bin/spawn-fcgi”
FCGIPROGRAM=”/usr/local/php-fcgi/bin/php”
USERID=lighttpd
GROUPID=lighttpd

# chown -R lighttpd:lighttpd /usr/local/lighttpd
# vi /usr/local/lighttpd/conf/lighttpd.conf

以下是lighttpd.conf中需要修改的部分:
server.document-root = “/usr/local/lighttpd/html”
server.errorlog = “/usr/local/lighttpd/log/lighttpd.error.log”
accesslog.filename = “/usr/local/lighttpd/log/access.log”
server.pid-file??????????? = “/var/run/lighttpd.pid”

server.username = “lighttpd”
server.groupname = “lighttpd”

compress.cache-dir???????? = “/tmp”
compress.filetype????????? = (“text/plain”, “text/html”)

fastcgi.server???????????? = ( “.php” =>
( “localhost” =>
(
“socket” => “/tmp/php-fastcgi.socket”,
“bin-path” => “/usr/local/php-fcgi/bin/php”
)
)
)
四、安装PHP
===========
# cd /usr/local/src
# tar xzvf php-4.2.2.tar.gz
# cd php-4.4.2
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –prefix=/usr/local/php-fcgi –enable-fastcgi –with-mysql –enable-zend-multibyte –with-config-file-path=/usr/local/php-fcgi/etc –enable-discard-path –enable-force-cgi-redirect –with-gd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –enable-xml –enable-mbstring
# make
# make install
# cp php.ini-dist /etc/php.ini
五、安装eAccelerator
====================
# /usr/local/src
# bunzip2 -d eaccelerator-0.9.4.tar.bz2
# tar -xvf eaccelerator-0.9.4.tar
# cd eaccelerator-0.9.4
# export PHP_PREFIX=”/usr/local/php-fcgi”
# $PHP_PREFIX/bin/phpize
# CHOST=”i686-pc-linux-gnu” CFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” CXXFLAGS=”-O3 -msse2 -mmmx -mfpmath=sse -funroll-loops -mcpu=pentium4 -march=pentium4 -pipe -fomit-frame-pointer” ./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
# make
# make install
(eAccelerator安装在/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX)
# cat eaccelerator.ini >> /usr/local/php-fcgi/etc/php.ini
# vi /usr/local/php-fcgi/etc/php.ini
//全局部分
cgi.fix_pathinfo = 1
extension_dir = “/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX”
zlib.output_compression = On

//eAccelerator部分
zend_extension = “/usr/local/php-fcgi/lib/php/extensions/no-debug-non-zts-XXXXXXXX/eaccelerator.so”
eaccelerator.shm_size = “0″
eaccelerator.cache_dir = “/tmp”
eaccelerator.enable = “1″
eaccelerator.optimizer = “1″
eaccelerator.debug = 0
eaccelerator.log_file = “/var/log/eaccelerator_log”
eaccelerator.name_space = “”
eaccelerator.check_mtime = “1″
eaccelerator.filter = “”
eaccelerator.shm_max = “0″
eaccelerator.shm_ttl = “0″
eaccelerator.shm_prune_period = “0″
eaccelerator.shm_only = “0″
eaccelerator.compress = “1″
eaccelerator.compress_level = “9″
eaccelerator.keys???? = “shm_and_disk”
eaccelerator.sessions = “shm_and_disk”
eaccelerator.content = “shm_and_disk”
eaccelerator.admin.name = “SET_USERNAME”
eaccelerator.admin.password = “SET_PASSWORD”
六、启动PHP-FastCGI
===================
# /usr/local/lighttpd/bin/spawn-php.sh
七、启动Lighttpd
================
# vi /etc/rc.d/init.d/lighttpd (检查脚本将文件中的路径设置为本机环境路径,例如Lighttpd配置文件位置)
# service lighttpd start
八、测试
========
# ps aux | grep php

下载本文
显示全文
专题