linux apache安装

准备配置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
 终于安装完成了。
 测试启动apache之前先修改httpd.conf
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 httpd
ok,访问http://127.0.0.1 ,成功。“It works!”

转载于:https://my.oschina.net/heartdong/blog/97912

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值