发新话题
打印

[apache] LAMP架构中的随笔————安装部分

LAMP架构中的随笔————安装部分

LAMP架构安装部分文档   @ version 0.5
#mysql完整配置
#groupadd mysql
#useradd -g mysql -s /sbin/nologin -M mysql
#tar -zxvf mysql-5.0.33.tar.gz
#./configure --prefix=/opt/app/mysql5 --without-debug --without-bench --with-charset=utf8 --with-extra-charsets=all --with-plugins=fthightman --enable-thread-safe-client
#make
#make install
#cp support-files/my-medium.cnf /etc/my.cnf
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#cd /opt/app/mysql5
#bin/mysql_install_db --user=mysql
#chown -R root  .
#chown -R mysql var
#chgrp -R mysql .
#chkconfig --add mysqld
#bin/mysqld_safe --user=mysql & 或者 /etc/rc.d/init.d/mysqld start 启动数据库
#/opt/app/mysql5/share/mysql/mysql.server stop 停止数据库

#安装apache完整配置
#groupadd httpd
#useradd -g httpd -s /sbin/nologin -M httpd
#tar -zxvf httpd-2.2.4.tar.gz
#./configure --prefix=/opt/app/apache2 --enable-so --with-mpm=worker --enable-rewrite=shared --disable-FEATURE --disable-authn-file --disable-authn-default --disable-authz-host --disable-authz-groupfile --disable-authz-user --disable-authz-default --disable-auth-basic --disable-include --disable-filter --disable-charset-lite --disable-env --disable-setenvif --disable-status --disable-autoindex --disable-asis --disable-cgid --disable-cgi  --disable-negotiation --disable-actions --disable-userdir --disable-alias
#make
#make install
#vi /opt/app/apache/conf/httpd.conf
更改:
     User httpd
     Group httpd
     
ServerSignature off  //禁止显示apache版本号。
serverTokens prod

<IfModule mpm_worker_module>
    StartServers        5   //设置了服务器启动时建立的子进程数量, 默认值是"3"。
    ServerLimit         50  //服务器允许配置的进程数上限, Apache在编译时内部有一个硬限制"ServerLimit 20000"。你不能超越这个限制。
    ThreadLimit         256   //每个子进程可配置的线程数上限。
    MaxClients          1600  //设置了允许同时伺服的最大接入请求数量。任何超过MaxClients限制的请求都将进入等候队列
    MinSpareThreads     1280  //设置最小空闲线程数,用于处理可能到来的突发请求。默认值是"75"。
    MaxSpareThreads     1408  //设置最大空闲线程数。不同的MPM对这个指令的处理是不一样的:默认值是"250"。这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太多,子进程将杀死多余的空闲线程。
    ThreadsPerChild     64  //设置了每个子进程建立的线程数。子进程在启动时建立这些线程后就不再建立新的线程了。默认值是25
    maxRequestsPerChild 100 //每个子进程可处理的请求数

</IfModule>

#安装GD库
1.安装  jpeg6
建立目录
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /usr/local/src
# tar -zxvf jpegsrc.v6b.tar.gz
# cd jpegsrc.v6b
#./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make; make install

2.安装 libpng
# cd /usr/local/src
# tar -jxvf libpng-1.2.8.tar.bz2
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make; make install

3.安装 freetype
# cd /usr/local/src
# tar -zxvf freetype-2.3.2.tar.gz
# cd freetype-2.3.2
# ./configure --prefix=/usr/local/freetype
# make;make install

4.安装libXML2
# cd /usr/local/src
# tar xjvf libxml2-2.6.24.tar.bz2
# cd libxml2-2.6.24
# ./configure --prefix=/usr/local/libxml
# make
# make install

5.安装zlib
安装 zlib
# cd /usr/local/src
# tar zxvf zlib-1.2.2.tar.gz
# cd zlib-1.2.2
# ./configure --prefix=/usr/local/zlib
# make
# make install

6.安装 GD2
# cd /usr/local/src
# tar xzvf gd-2.0.34.tar.gz
# cd gd-2.0.34
#./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype
# make
# make install


#安装PHP完整配置
#tar -zxvf php-5.2.0.tar.gz
#./configure --prefix=/opt/app/php5 --with-libxml-dir=/usr/local/libxml --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg6 --with-zlib-dir=/usr/local/zlib --with-libpng-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --enable-mbstring --with-apxs2=/opt/app/apache2/bin/apxs --with-mysql=/opt/app/mysql5 --with-config-file-path=/opt/app/php5/etc
#cp php.ini-dist /opt/app/php5/etc/php.ini
#make
#make install

#优化php完整配置Zend Optimizer
#tar xzvf ZendOptimizer-3.2.0-linux-glibc21-i386.tar.gz
#./install
以此往下运行填写php.ini位置.  *安装完毕之后会让你选择是否重新启动apache请选择NO。


#加速PHP运行程序eaccelerator
#tar -jxvf eaccelerator-0.9.5.2.tar.bz2
#export PHP_PREFIX="/opt/app/php5"
#$PHP_PREFIX/bin/phpize
#./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
#make
#make install
//这时会将eaccelerator安装到php目录中,屏幕会显示eaccelerator.so所在路径                *记住该路径。。。
#vim /opt/app/php/etc/php.ini
   [eaccelerator]
   zend_extension="/opt/app/php5/lib/php/extensions/no-debug-non-zts-20080424/eaccelerator.so"
   eaccelerator.shm_size="16"  //eaccelerator可使用的共享内存大小(单位为MB)。
   eaccelerator.cache_dir="/tmp/cache/eaccelerator"    //缓存路径.
   eaccelerator.enable="1"      //打开或者关闭eaccelerator。"1"指打开,"0"指关闭。默认值为"1"。
   eaccelerator.optimizer="1"   //打开或者关闭代码优化,开启可以加快代码的执行速度。"1"指打开,"0"指关闭。默认值为"1"。
   eaccelerator.check_mtime="1"     //当打开此项时,eaccelerator会在每次请求时检查php文件的修改时间,看其是否被修改过,这会耗费一点时间,如果php文件被修改过, eaccelerator会重新编译缓存该php文件。当关闭此项时,如果php文件被修改,则需要手工删除eaccelerator缓存,才能显示被修改的php文件。"1"指打开,"0"指关闭。默认值为"1"。
   eaccelerator.debug="0"           //打开或者关闭调试记录。当打开时,eaccelerator会将对一个缓存文件的每次请求都写进log。打开此项只对调试 eaccelerator是否有BUG时有益处。"1"指打开,"0"指关闭。默认值为"0"。
   eaccelerator.log_file = "/var/log/eaccelerator_log"   //调试记录日志。
   eaccelerator.filter=""     //决定哪些PHP文件应该被缓存。可以指定一个范围(比如"*.php *.phtml"),这样被指定的文件就会被缓存。如果该范围以!开头,被指定的文件就不会被缓存。默认值为"",表示缓存所有的PHP文件。
   eaccelerator.shm_max="0"     //一个用户使用例如eaccelerator_put之类的函数能够往共享内存中加载的最大数据。默认值为"0",表示不限制。(单位为字节)
   eaccelerator.shm_ttl="0"     //当没有足够的空闲共享内存去尝试缓冲一个新脚本时,将删除至少在shm_ttl秒之前没有被访问过的文件。默认值为"0",表示不尝试从共享内存中删除任何旧的脚本。(单位为秒)
   eaccelerator.shm_prune_period="0"   //当没有足够的空闲共享内存去尝试缓冲一个新脚本时,将删所有旧脚本,前提是这个尝试在超过shm_prune_period秒之前被执行过。默认值为"0",表示不尝试从共享内存中删除任何旧的脚本。(单位为秒)
   eaccelerator.shm_only="0"    //打开或者关闭在磁盘上缓存编译过的脚本。这个参数对会话数据和内容缓存没有效果。默认值为"0",表示使用磁盘和共享内存来缓存。
   eaccelerator.compress="1"    //打开或者关闭缓存内容压缩。"1"指打开,"0"指关闭。默认值为"1"。
   eaccelerator.compress_level="9"    //内存压缩的级别。默认值为"9",表示最大压缩。

建立缓存目录:
#mkdir -p /tmp/cache/eaccelerator
#chmod 0777 /tmp/cache/eaccelerator

eaccelerator配置完毕重新启动httpd
#/opt/app/apache2/bin/apachectl restart

[ 本帖最后由 linux-admin 于 2008-6-25 20:27 编辑 ]

TOP

好东西,很详细,收藏了,以便参考

TOP

收到,呵呵
呼吸的是如此的自然,即使是狼也感觉不到

TOP

好东西,收藏了

TOP

看了
love linux, love life ,love travelling

TOP

配置了LAMP还不知有:eaccelerator

只知有Zend Optimizer 。

又学到了

TOP

不错. . . .. .
. . . . . . 了解了. .  ..  . . .
  . .  .. 以后会主义的。.  ..

TOP

大善 .  .
收下了。  ..谢了..
累!
好累!
真的好累!

TOP

发新话题