tomcat篇之tomcat結合apache中的模組proxy反代理之apache安裝

來源:互聯網
上載者:User

標籤: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安裝

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.