標籤:apache
前提條件
rpm -qa httpd
yum -y install pcre-devel
1、編譯安裝apr
tar xf apr-1.5.2.tar.gz
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
2、編譯安裝apr-util
tar xf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
#--with-apr=PATH
#--prefix=PREFIX
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make && make install
3、編譯安裝apache
tar xf httpd-2.4.18.tar.gz
cd httpd-2.4.18
./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so \
--enable-ssl --enable-cgi --enable-rewrite --with-zlib --enable-mpms-shared=all \
--with-mpm=event --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util \
--enable-proxy --enable-proxy-http --enable-proxy-ajp --enable-proxy-balancer \
--enable-lbmethod-heartbeat --enable-slotmem-shm --enable-slotmem-plain \
--enable-heartbeat --enable-heartmonitor --enable-watchdog
make && make install
配置apache通過mod_proxy模組與tomcat結合
要使用mod_proxy與tomcat結合,需要apache已經安裝mod_proxy、mod_proxy_http、mod_proxy_ajp和proxy_balancer_module
(實現tomcat叢集時會用到)等模組
嘗試啟動apache
/usr/local/apache/bin/httpd -k start
netstat -tunlp
發現並沒有80連接埠起來,嘗試幾遍還是啟動不來
查看httpd日誌
cat /usr/local/apache/logs/error_log發現如下錯誤:
[Tue May 17 07:10:46.572233 2016] [proxy_balancer:emerg] [pid 1434:tid 139691988010752] AH01177: Failed to lookup provider ‘shm‘ for ‘slotmem‘: is mod_slotmem_shm loaded??
[Tue May 17 07:10:46.572778 2016] [:emerg] [pid 1434:tid 139691988010752] AH00020: Configuration Failed, exiting
[Tue May 17 07:16:15.916227 2016] [proxy_balancer:emerg] [pid 1438:tid 139879976126208] AH01177: Failed to lookup provider ‘shm‘ for ‘slotmem‘: is mod_slotmem_shm loaded??
[Tue May 17 07:16:15.916951 2016] [:emerg] [pid 1438:tid 139879976126208] AH00020: Configuration Failed, exiting
根據錯誤資訊發現模組mod_slotmem_shm並沒有載入,於是修改設定檔
vim /etc/httpd/httpd.conf
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so將注釋#去掉
/usr/local/apache/bin/httpd -k start
netstat -tunlp
於是服務終於啟動上來了
tomcat篇之tomcat結合apache中的模組proxy反代理之apache安裝