LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 827|回复: 0

LFS+Lighttpd 建超快web站

[复制链接]
发表于 2007-4-17 21:39:12 | 显示全部楼层 |阅读模式
编好LFS后依次按照BLFS安装Libxml、Libxml2、Libxslt、Libjpeg、Libpng

再安装mysql-5.0.21
命令参考了本站的一片大作,略做修改
groupadd -g 40 mysql &&
useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false \
        -u 40 mysql

C_EXTRA_FLAGS=-fno-strict-aliasing \
./configure --prefix=/usr \
            --sysconfdir=/etc \
            --libexecdir=/usr/sbin \
            --localstatedir=/srv/mysql \
            --enable-thread-safe-client \
            --enable-assembler \
--with-charset=ascii \
--with-extra-charsets=gb2312,utf8,gbk \
--with-named-thread-libs=-lpthread \
            --enable-local-infile \
            --with-unix-socket-path=/var/run/mysql/mysql.sock \
            --without-debug \
            --without-bench \
            --without-readline \
            --with-berkeley-db \
            --with-extra-charsets=all &&
make testdir=/tmp/mysql

make testdir=/tmp/mysql install &&
rm -rf /tmp/mysql &&
cd /usr/lib &&
ln -v -sf mysql/libmysqlclient{,_r}.so* .

install -v -m644 /usr/share/mysql/my-medium.cnf /etc/my.cnf

mysql_install_db --user=mysql &&
chgrp -v mysql /srv/mysql{,/test,/mysql}

install -v -m755 -o mysql -g mysql -d /var/run/mysql &&
mysqld_safe --user=mysql 2>&1 >/dev/null &

再编译php-5.0.4
命令如下:
./configure --prefix=/usr \
--enable-fastcgi \
   --enable-discard-path \
   --enable-force-redirect \
            --sysconfdir=/etc \
--with-libxml-dir=/usr --with-xsl \
--with-jpeg-dir=/usr --with-png-dir \
--with-openssl --with-regex=php \
--with-gnu-ld --with-tsrm-pthreads \
--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config \
--enable-memory-limit --enable-zend-multibyte \
--with-db4=/usr \
--with-iconv \
            --enable-force-cgi-redirect \
            --with-config-file-path=/etc \
            --with-zlib \
            --enable-bcmath \
            --with-bz2 \
            --enable-calendar \
            --enable-dba \
            --enable-exif \
            --enable-ftp \
            --with-gettext \
            --enable-mbstring \
            --with-ncurses \
            --with-readline
注意:一定要不要有  --with-apxs and --with-apxs2 项
make

make install &&
install -v -m644 php.ini-recommended /etc/php.ini

编辑php.ini,加入cgi.fix_pathinfo = 1

下载Lighttpd 1.4.15
地址:http://www.lighttpd.net/download/lighttpd-1.4.15.tar.gz

./configure --prefix=/usr/local/lighttpd
make
make install

9、配置Lighttpd

cp openwrt/lighttpd.conf /usr/local/lighttpd/

vi /usr/local/lighttpd/lighttpd.conf

根据自己的情况设置:
server.document-root
server.port

server.modules         = ( 加载下面两个模块
                    "mod_access",
                    "mod_fastcgi",
)

加入下面配置
fastcgi.server = ( ".php" => ((
              "bin-path" => "/usr/bin/php",
              "socket" => "/tmp/php.socket",
              "max-procs" => 2,
              "bin-environment" => (
              "HP_FCGI_CHILDREN" => "16",
              "HP_FCGI_MAX_REQUESTS" => "10000"
              ),
              "bin-copy-environment" => (
              "ATH", "SHELL", "USER"
              ),
              "broken-scriptfilename" => "enable"
          )))

启动:/usr/local/lighttpd/bin/lighttpd -f /usr/local/lighttpd/lighttpd.conf

Ok 上传个PHP页面看看,速度超快!
参考文章:http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表