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/

 

無 

 編輯標籤

添加評論



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章