Linux服务器系统常用服务器配置手册
五、Web服务
以apache为中心,整理相关服务的安装与配置以及apache的整合说明。
5.1.apache安装过程
apache版本:httpd-2.2.6
#解压
# tar -xjvf httpd-2.2.6.tar.bz2
# cd httpd-2.2.6
# 编译
./configure –prefix=/usr/local/apache2 –with-mpm=worker –enable-so –enable-rewrite –enable-expires –enable-headers –enable-deflate –disable-actions –disable-userdir –disable-imap –disable-cgi –disable-asis –disable-autoindex
#make
#make install
#加入自启动项
# echo ‘/usr/local/apache2/bin/apachectl start ‘ >> /etc/rc.local
5.2.php安装配置
php版本:php-5.2.5
#解压
# tar -zvxf php-5.2.5.tar.gz
# cd php-5.2.5
#编译
./configure –prefix=/usr/local/php5 –with-mysql=/usr/local/mysql –with-png-dir –with-gd –with-iconv –with-jpeg-dir=/usr/lib64 –with-zlib –with-apxs2=/usr/local/apache2/bin/apxs
# make
# make install
5.3.1. PHP和apache的整合
# cp php.ini-dist /usr/local/php5/lib/php.ini
# vi /usr/local/apache2/conf/httpd.conf找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启apache,编写测试文件:
PHP
<?php
phpinfo();
?>
加载mod_rewrite模块
2个方法:
1、重新编译apache,并在原来编译的内容中加–enable-rewrite=shared
2.进入apache编码包路径,按以下顺序进行操作:
编译mod_rewrite.so模块,执行后将在apache源码包以下目录生成./modules/mappers/.libs/mod_rewrite.so
/usr/local/apache2/bin/apxs -c modules/mappers/mod_rewrite.c -lgdbm
让apache的apxs来自动向http.conf配置文件中加入LoadModule语句并将mod_rewrite.so文件拷贝到/usr/local/apache2/modules/目录
/usr/local/apache2/bin/apxs -i -A -n rewrite modules/mappers/.libs/mod_rewrite.so
编辑httpd.conf文件,开启mod_rewrite.so模块
/usr/local/apache2/conf/httpd.conf
进入后查找LoadModule rewrite_module modules/mod_rewrite.so将前面的注释符号#删除,并重启apache服务器
5.3.2 eAccelerator安装过程
eaccelerator版本:eaccelerator-0.9.5.3.tar.bz2
解压:
# tar -xjvf eaccelerator-0.9.5.3.tar.bz2
# export PHP_PREFIX=”/usr/local/php5″ (指定php所在路径)
# $PHP_PREFIX/bin/phpize
#编译
# ./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
#make
#make install
5.3.3 eAccelerator和PHP的整合
编译eAccelerator后会提示生成一个目录,如
Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20060613/,将其下的eaccelerator.so 拷贝到/usr/local/bin/
# cp /usr/local/php5/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so /usr/local/bin/
在php.ini中加入以下
extension=”/usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
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″
修改extension_dir = “./”为extension_dir = “/”
# mkdir /tmp/eaccelerator
# chmod 777 /tmp/eaccelerator
检查是否加载成功
# /usr/local/php5/bin/php -m
重启apache,即可
更新了linux.doc文档,增加了memcache的安装
THANK YOU VERY MUCH FOR YOUR ENCOURAGING WORDS ,FULL OF INSPIRATION
Well written!
I love this humour…:)
….interesting….
I have a personal passion for writing and spend a vast amount of time as an avid reader of other people’s work.
Ahhhhh! a very smart Heart!
The presentation is so unusual. I like that
these words made me stronger. i really loves this a lot!
Just wish to thank you for all the lights that you put on my path via your quotes, your themes, your issues, your works.
Bless:) Happy day!!
Ahhhhh! a very smart Heart!
HeHe, Love it! Thanks.
I was wondering the same thing.
All the very best