LoadModule proxy_module modules/mod_proxy.so
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
[root@centos1 conf]# more /jspre/tomcat7/webapps/ROOT/centos.jsp
<%
out.print("hello centos 1");
out.print("
%>
<%=session.getId()%>
[root@centos1 conf]#
proxyName="www.aaaanba.edu" proxyPort="80" connectionTimeout="20000" redirectPort="8443" /> [root@centos1 conf]# systemctl list-unit-files | grep "firewalld" firewalld.service enabled [root@centos1 conf]# systemctl status firewalld.service 鈼?firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2018-01-10 00:59:57 CST; 1min 48s ago Docs: man:firewalld(1) Main PID: 22377 (firewalld) CGroup: /system.slice/firewalld.service 鈹斺攢22377 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid Jan 10 00:59:56 centos1 systemd[1]: Starting firewalld - dynamic firewall daemon... Jan 10 00:59:57 centos1 systemd[1]: Started firewalld - dynamic firewall daemon. 浏览器不能直接访问8080,只能通过代理访问 [root@centos1 conf]# systemctl stop firewalld.service [root@centos1 conf]# systemctl status firewalld.service 鈼?firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled) Active: inactive (dead) since Wed 2018-01-10 01:02:07 CST; 3s ago Docs: man:firewalld(1) Process: 22377 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS) Main PID: 22377 (code=exited, status=0/SUCCESS) Jan 10 00:59:56 centos1 systemd[1]: Starting firewalld - dynamic firewall daemon... Jan 10 00:59:57 centos1 systemd[1]: Started firewalld - dynamic firewall daemon. Jan 10 01:02:06 centos1 systemd[1]: Stopping firewalld - dynamic firewall daemon... Jan 10 01:02:07 centos1 systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@centos1 conf]# [root@centos1 tmp]# ll tomcat-connectors-1.2.46-src.tar.gz -rw-r--r--. 1 root root 3252837 Jun 29 2018 tomcat-connectors-1.2.46-src.tar.gz [root@centos1 tmp]# tar -xzvf tomcat-connectors-1.2.46-src.tar.gz [root@centos1 native]# pwd /tmp/tomcat-connectors-1.2.46-src/native [root@centos1 native]# ./configure checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... configure: error: newly created file is older than distributed files! Check your system clock [root@centos1 native]# 将时间改新 [root@centos1 native]# date -s 20181111 checking for target platform... unix no apache given no netscape given configure: error: Cannot find the WebServer [root@centos1 native]# [root@centos1 native]# which apxs /usr/bin/apxs [root@centos1 native]# rpm -qf /usr/bin/apxs httpd-devel-2.4.6-80.el7.centos.x86_64 [root@centos1 native]# [root@centos1 native]# ./configure --help | grep "apx" --with-apxs[=FILE] Build shared Apache module. FILE is the optional pathname to the apxs tool; defaults to finding apxs in your PATH. [root@centos1 native]# find ./ -name "mod_jk.so" [root@centos1 native]# ./configure --help | grep "apx" --with-apxs[=FILE] Build shared Apache module. FILE is the optional pathname to the apxs tool; defaults to finding apxs in your PATH. [root@centos1 native]# ./configure --with-apxs=/usr/bin/apxs [root@centos1 native]#make [root@centos1 native]# [root@centos1 native]# find ./ -name "mod_jk.so" ./apache-2.0/.libs/mod_jk.so ./apache-2.0/mod_jk.so [root@centos1 native]# [root@centos1 native]# find / -name "mod_jk.so" /tmp/tomcat-connectors-1.2.46-src/native/apache-2.0/.libs/mod_jk.so /tmp/tomcat-connectors-1.2.46-src/native/apache-2.0/mod_jk.so /usr/lib64/httpd/modules/mod_jk.so [root@centos1 native]# LoadModule jk_module modules/mod_jk.so ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ 浏览器访问
防火墙firewalld
防火墙启动状态
防火墙停止状态
Apache jk Support
解压源代码
配置
再运行configure
安装httpd-devel包
再运行configure
生成mod_jk.so
复制mod_jk.so到httpd的modules
编辑/etc/httpd/conf/httpd.conf
代理访问 centos.jsp