准备配置apache tomcat集群,一个一个安装先,记录下过程
wget http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.3.tar.gz tar zxvf httpd-2.4.3.tar.gz -C /usr/local cd /usr/local/httpd-2.4.3 ./configure --prefix=/usr/local/apache --enable-modules=shared --enable-mods-shared=all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-dav --enable-so
#激活tomcat集群需要的 enable-proxy,enable-proxy-http,enable-proxy-connect,enable-proxy-ajp和enable-proxy-balancer,其中proxy-ajp和proxy-balancer必须依赖proxy,如果是自定义的编译除了以上几个必须的模块外,mod_status也要编译进去。enable-proxy-ftp可以不编译。
出错了!提示:
checking for APR... no configure: error: APR not found. Please read the documentation.解决APR not found
wget http://labs.mop.com/apache-mirror//apr/apr-1.4.6.tar.gz tar zxf apr-1.4.6.tar.gz cd /usr/local/apr-1.4.6 ./configure --prefix=/usr/local/apr make && make install完成后再来configure apache
./configure --prefix=/usr/local/apache --enable-modules=shared --enable-mods-shared=all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-rewrite checking for APR-util... no configure: error: APR-util not found. Please read the documentation.去,还来,解决APR-util not found
wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.5.1.tar.gz tar zxf apr-util-1.5.1.tar.gz cd apr-util-1.5.1/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr-util make && make install完成后再次configure apache
./configure --prefix=/usr/local/apache --enable-modules=shared --enable-mods-shared=all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util依然还有依赖问题
checking for pcre-config... false configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/下载对应的依赖包
wget http://ftp.exim.llorien.org/pcre/pcre-8.32.zip unzip pcre-8.32 cd pcre-8.32/ ./configure --prefix=/usr/local/pcre make && make install继续编译configure apahe
./configure --prefix=/usr/local/apache --enable-modules=shared --enable-mods-shared=all --enable-proxy --enable-proxy-connect --enable-proxy-ftp --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre乖乖,终于没报错了,安装make && make install
cd /usr/local/apache/ vi conf/httpd.conf查找ServerName
#ServerName www.example.com:80 复制这行,添加一样 ServerName 192.168.95.129:80#这里要改成自己对应的IP保存并推出。然后再执行
bin/apachectl -k start然后执行
ps -ef | grep httpd查看程序时候运行起来,结果居然没有
tail logs/error_log [Mon Dec 24 08:50:18.930473 2012] [proxy_balancer:emerg] [pid 17676:tid 3077654736] AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??找到原因,原来是httpd.conf里面的mod_slotmem_shm.so没有加载
vi conf/httpd.conf 把#号去掉 #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so 变成 LoadModule slotmem_shm_module modules/mod_slotmem_shm.so重新启动apache
bin/apachectl -k start [root@localhost apache]# ps -ef | grep httpd root 17705 1 0 08:55 ? 00:00:00 /usr/local/apache/bin/httpd -k start daemon 17706 17705 0 08:55 ? 00:00:00 /usr/local/apache/bin/httpd -k start daemon 17707 17705 0 08:55 ? 00:00:00 /usr/local/apache/bin/httpd -k start daemon 17708 17705 0 08:55 ? 00:00:00 /usr/local/apache/bin/httpd -k start root 17795 2430 0 08:59 pts/2 00:00:00 grep httpdok,访问http://127.0.0.1 ,成功。“It works!”