apache 安装

文档历史

 

 

版本

日期

作者

修改历史

1.0

20100730

steve.luo

新建文档

















 

 

 

 

目录

1. 安装环境... 4

2. 安装步骤... 5

2.1. 安装zlib如果要使用apache deflate模块需要用到zlib... 5

2.2. 安装配置apache. 5

2.2.1. 编译并安装apache. 5

2.2.2. 配置apache. 6

2.2.3. mod_jk.so获取... 9

 

1.安装环境

OS: SUSE Linux Enterprise Server 10

Apache: 2.2.14

Jk:  1.2.28

 

 

2.安装步骤

2.1.安装zlib如果要使用apache deflate模块需要用到zlib

# cd /data/postmall/steve

# tar -xzvf zlib-1.2.3.tar.gz

# cd zlib-1.2.3

# ./configure

vi Makefile
找到 CFLAGS=-O3 -DUSE_MMAP
在后面加入-fPIC即变成CFLAGS=-O3 -DUSE_MMAP -fPIC

# make

# make install

 

2.2.安装配置apache

2.2.1.编译并安装apache

http://httpd.apache.org/download.cgi下载apache 2.2.14版上传至服务器临时目录这里假设为/data/postmall/steve

 

# cd /data/postmall/steve

# tar zxvf httpd-2.2.14.tar.gz

# cd httpd-2.2.14

# vi  server/mpm/worker/worker.c

修改

#define DEFAULT_SERVER_LIMIT 512Default 16

#define MAX_SERVER_LIMIT 20000

#define DEFAULT_THREAD_LIMIT 1024 (Default 64)

#define MAX_THREAD_LIMIT 20000

# ./configure --prefix=/usr/local/apache --with-mpm=worker --enable-mods-shared=all --enable-so --enable-most --enable-max  --enable-rewrite=shared --enable-speling=shared --enable-deflate=shared  --enable-cache=shared --enable-file-cache=shared --enable-proxy=shared --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --enable-proxy-ajp=shared  --enable-proxy-balancer=shared

# make

# make install

将/usr/local/apache/lib添加到/etc/ld.so.conf

# echo /usr/local/apache/lib >> /etc/ld.so.conf

# ldconfig

# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd

确保httpd在系统启动后自动启动

# chkconfig --list|grep httpd

httpd                     0:off  1:off  2:off  3:on   4:off  5:on   6:off

如果上面全部显示为off则执行

# chkconfig httpd on

以root身份可以启动或者停止httpd进程但在配置好之前无需启动apache

# /sbin/service  httpd start (stop, restart)

# mkdir  -p  /data/logs/apache

 

2.2.2.配置apache

   /usr/local/apache/conf/httpd.conf

       将启动用户和组改为web 和 users

User web

Group users

 

增加如下配置使apache可以顺利访问到/data/postmall目录

<Directory "/data/postmall">

        Options FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

</Directory>

 

增加jk模块, mod_jk.so文件的获取参考mod_jk获取一节

LoadModule jk_module modules/mod_jk.so

## JK Modules Config

JkWorkersFile /usr/local/apache/conf/workers.properties

JkLogFile /data/logs/apache/mod_jk.log

JkLogLevel warn

JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

JkShmFile /data/logs/apache/mod_jk.shm

 

在DirectoryIndex后增加index.php index.jsp

       DirectoryIndex index.html index.php index.jsp

 

将下面这行前面的#去掉

              Include conf/extra/httpd-vhosts.conf

 

   /usr/local/apache/conf/workers.properties (新增文件)

worker.list=ule1
worker.ule1.type=ajp13
worker.ule1.port=8009
worker.ule1.connection_pool_size=256
worker.ule1.connection_pool_timeout=300
worker.ule1.connection_pool_minsize=128
worker.ule1.socket_timeout=300

 

worker.list=ule2
worker.ule2.type=ajp13
worker.ule2.port=9009
worker.ule2.connection_pool_size=256
worker.ule2.connection_pool_timeout=300
worker.ule2.connection_pool_minsize=128
worker.ule2.socket_timeout=300

 

   /usr/local/apache/conf/extra/httpd-mpm.conf

       将原有的mpm_worker配置信息注释掉用下面的配置

       <IfModule mpm_worker_module>

        StartServers          5

        ServerLimit        128

        MaxClients          25600

        MinSpareThreads      50

        MaxSpareThreads      200

        ThreadLimit        384

        ThreadsPerChild      256

        MaxRequestsPerChild  10000

</IfModule>

 

 

   /usr/local/apache/conf/extra/httpd-vhosts.conf

NameVirtualHost *:80

 <VirtualHost *:80>
        ServerName  card.ule.tom.com

        ServerAlias    card.ulechina.tom.com

        DocumentRoot  /data/postmall/tomcat/webapps_ulecard/ROOT

        JkMount /* ule1

        ErrorLog "/data/logs/apache/ulecard-error.log"
        CustomLog "/data/logs/apache/ulecard-access.log" combined
</VirtualHost>

 

<VirtualHost *:80>
        ServerName  egiftcard.ule.tom.com

        DocumentRoot  /data/postmall/tomcat/webapps_egiftcard/ROOT

        JkMount /* ule2

        ErrorLog "/data/logs/apache/egiftcard-error.log"
        CustomLog "/data/logs/apache/egiftcard-access.log" combined
</VirtualHost>

 

2.2.3. mod_jk.so获取

http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/linux/jk-1.2.28/ 根据不同的系统平台以及apache版本下载相应的 .so文件并改名为mod_jk.so拷贝至 /usr/local/apache/module/下

 

或者

 

    # tar -zxvf tomcat-connectors-1.2.28-src.tar.gz

    # cd tomcat-connectors-1.2.28-src/native

    # ./configure --with-apxs=/usr/local/apache/bin/apxs

       # make

       # cp apache-2.0/mod_jk.so /usr/local/apache/modules/

 

无 

 编辑标签

添加评论



本文出自 “zhanghe” 博客,请务必保留此出处http://9206668.blog.51cto.com/9196668/1592338

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。