首页 > 服务器 > Linux服务器系统常用服务器配置手册

Linux服务器系统常用服务器配置手册

2009年03月31号
查看评论 发表评论 1,895次浏览

 五、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 eAcceleratorPHP的整合

 

编译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,即可

页面: 1 2 3 4 5

  1. 高手
    发表于 2009年04月07号 18时58分11秒 | 1楼

    更新了linux.doc文档,增加了memcache的安装

  2. nhl hockey jerseys
    发表于 2010年06月15号 05时55分32秒 | 2楼

    THANK YOU VERY MUCH FOR YOUR ENCOURAGING WORDS ,FULL OF INSPIRATION

  3. Air Force 1 Shoes
    发表于 2010年06月16号 09时18分31秒 | 3楼

    Well written!

  4. mbt sport shoes
    发表于 2010年06月18号 02时32分12秒 | 4楼

    I love this humour…:)

  5. cheap bikinis
    发表于 2010年06月18号 07时56分12秒 | 5楼

    ….interesting….

  6. nike Hyperdunk Shoes
    发表于 2010年06月20号 01时10分44秒 | 6楼

    I have a personal passion for writing and spend a vast amount of time as an avid reader of other people’s work.

  7. kobe iv
    发表于 2010年06月21号 15时26分02秒 | 7楼

    Ahhhhh! a very smart Heart!

  8. herve leger discount
    发表于 2010年06月22号 17时22分15秒 | 8楼

    The presentation is so unusual. I like that

  9. kobe hyperdunk
    发表于 2010年06月23号 01时37分24秒 | 9楼

    these words made me stronger. i really loves this a lot! :D

  10. puma drift cat
    发表于 2010年06月23号 03时48分22秒 | 10楼

    Just wish to thank you for all the lights that you put on my path via your quotes, your themes, your issues, your works.

  11. lacoste shoes
    发表于 2010年06月24号 08时24分11秒 | 11楼

    Bless:) Happy day!!

  12. sale christian louboutin evening shoes
    发表于 2010年06月24号 09时41分07秒 | 12楼

    Ahhhhh! a very smart Heart!

  13. mbt shoes sale
    发表于 2010年06月25号 04时38分54秒 | 13楼

    HeHe, Love it! Thanks.

  14. handbags on sale
    发表于 2010年06月26号 08时50分27秒 | 14楼

    I was wondering the same thing.

  15. nike nba basketball shoes
    发表于 2010年06月26号 15时23分16秒 | 15楼

    All the very best

评论页数:
1 2 3 ... 5 110
  1. 目前没有通告