码迷,mamicode.com
首页 > Web开发 > 详细

apache的使用

时间:2015-04-07 17:53:57      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

1) download apr1.4.6, apr-util-1.5.1, mod_jk, pcre
http://www.apache.org/dist/apr/  (include apr and apr-util)
http://sourceforge.net/projects/pcre/files/pcre/  
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/

2) install apr
#---------------------------------
tar zxvf apr-1.4.6.tar.gz
./configure --prefix=/opt/apr-1.4.6
./make && make install

3) install apr-util-1.4.1
#---------------------------------
tar zxvf apr-util-1.4.1.tar.gz
./configure --prefix=/opt/apr-util-1.4.1 --with-apr=/opt/apr-1.4.6
make && make install

4) install pcre
tar zxvf pcre-8.30.tar.gz
./configure --prefix=/opt/pcre
make && make install

5) copy apr related source to httpd-2.4.3/srclib/
#avoid Bundled APR requested but not found at ./srclib/ error doing the following copy
cp -rf apr-1.4.6 httpd-2.4.3/srclib/apr
cp -rf apr-util-1.5.1 httpd-2.4.3/srclib/apr-util

6) install apache-2.4.3
#---------------------------------
#./configure --prefix=/opt/apache2.4.3 \
./configure --prefix=/opt/httpd \
--disable-status \
--disable-userdir \
--disable-cgi \
--disable-cgid \
--disable-include \
--disable-autoindex \
--disable-asis \
--disable-imap \
--disable-actions \
--enable-file-cache \
--enable-cache \
--enable-cache-disk \
--enable-ssl \
--with-ssl=/usr/bin/openssl \
--with-mpm=worker \
--sysconfdir=/opt/httpd/conf \
--with-apr=/opt/apr \
--with-apr-util=/opt/apr-util \
--with-pcre=/opt/pcre \
--with-included-apr \

make && make install

7) install tomcat-connector( mod_jk.so)
#---------------------------------
cd /opt/src/tomcat-connectors-1.2.37-src/native
./configure --with-apxs=/opt/httpd/bin/apxs
make && make install
#----------------------------------------

8) edit /opt/httpd/conf/httpd.conf
LoadModule jk_module modules/mod_jk.so
# add by yongcheng.zhou for load balancing begin
JkWorkersFile /opt/www/conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"
JkShmFile logs/mod_jk.shm

<VirtualHost 192.168.0.48:80>
    DocumentRoot /var/www/html
    ServerName www.twd.cn
    ErrorLog logs/twd_error.log
    JkMount /* loadbalancer
    JkMount /balancer-manager/* statusworker
</VirtualHost>
#------------------------------------------

#--------------------------------------------------------------
#  workers.properties
#--------------------------------------------------------------
worker.list=worker1,worker2,loadbalancer,statusworker
# default properties for workers
worker.template.type=ajp13
worker.template.port=8009
worker.template.lbfactor=50
worker.template.connection_pool=50
worker.template.connection_pool_timeout=600
worker.template.socket_keepalive=true
worker.template.socket_timeout=300

# properties for worker1
worker.worker1.reference=worker.template
worker.worker1.host=192.168.0.114

# properties for worker2
worker.worker2.reference=worker.template
worker.worker2.host=192.168.0.115

# properties for loadbalancer
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=worker1,worker2
worker.statusworker.type=status
#--------------------------------------------------------------

<IfModule mod_cache.c>
    CacheIgnoreCacheControl On
    CacheIgnoreNoLastMod On
    CacheStoreNoStore On
    CacheStorePrivate On
    CacheEnable mem /images
</IfModule>

<IfModule mod_mem_cache.c>
    MCacheSize 1310720
    MCacheMaxObjectCount 100000
    MCacheMinObjectSize 1
    MCacheMaxObjectSize 1310720
    MCacheMaxStreamingBuffer 1310720
</IfModule>

# install tomcat7
192.168.0.114
192.168.0.115
tar zxvf tomcat*.tar.gz

# open port 8080, 8009 in iptables /etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8009 -j ACCEPT

#restart iptables
service iptables stop
service iptables start

apache的使用

标签:

原文地址:http://my.oschina.net/u/1453451/blog/396962

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!