apache的使用

ref : http://www.apachetutor.org/admin/reverseproxieshtml

Basic concept:linux

1) must install apr and apr-util (think about JVM) and source located on httpd/srclib, you can compile and install it.apache

2) on product environment, set linux run level 3tomcat

3) --enable-modules=most    (static compile to apache)socket

4)--enable-mods-shared=most  (dynamic shared object)
tcp

刪除源碼安裝的apache:.net

make cleanrest

rm  -R /opt/httpdorm

安裝apachehtm

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 \

--enable-mods-shared=most \--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 install7) install tomcat-connector( mod_jk.so)#---------------------------------cd /opt/src/tomcat-connectors-1.2.37-src/native./configure --with-apxs=/opt/httpd/bin/apxsmake && make install#----------------------------------------8) edit /opt/httpd/conf/httpd.confLoadModule jk_module modules/mod_jk.so# add by yongcheng.zhou for load balancing beginJkWorkersFile /opt/www/conf/workers.propertiesJkLogFile logs/mod_jk.logJkLogLevel errorJkLogStampFormat "[%a %b %d %H:%M:%S %Y] "JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectoriesJkRequestLogFormat "%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 workersworker.template.type=ajp13worker.template.port=8009worker.template.lbfactor=50worker.template.connection_pool=50worker.template.connection_pool_timeout=600worker.template.socket_keepalive=trueworker.template.socket_timeout=300# properties for worker1worker.worker1.reference=worker.templateworker.worker1.host=192.168.0.114# properties for worker2worker.worker2.reference=worker.templateworker.worker2.host=192.168.0.115# properties for loadbalancerworker.loadbalancer.type=lbworker.loadbalancer.balance_workers=worker1,worker2worker.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 tomcat7192.168.0.114192.168.0.115tar 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 iptablesservice iptables stopservice iptables start

相關文章
相關標籤/搜索