tomcat-LNMT
LNMT
client > nginx > reverse_proxy > http > tomcat (http connector)
1.配置nginx
# yum install nginx
# cd /etc/nginx
# vim nginx.conf
location / {
proxy_pass http://192.168.11.224:8080/;
}
# nginx -t
# systemctl start nginx.service
# systemctl status nginx.service
# systemctl stop nginx.service
// 访问80口如果提示“tomcat The page you are looking for is temporarily unavailable”
// SELINUX 未关闭,关闭SELINUX或着运行以下命令
# getsebool -a | grep httpd_can_network_connect
# setsebool -P httpd_can_network_connect 1
// 编辑客户端hosts
192.168.11.224 web1.new.com
# mkdir -pv /data/{webapps,logs}
# cp -r /usr/local/tomcat/webapps/myapp/* /data/webapps/
# vim /usr/local/tomcat/conf/server.xml
<Host name="web1.new.com" appBase="/data/webapps" unpackWAR="true" autoDeploy="false">
<Context path="" docBase="/data/webapps" reloadable="true" />
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="/data/logs" prefix="web1_access_log" suffix=".txt" pattern="%h %1 %u %t "%r" %s %b"/>
</Host>
# catalina.sh stop
# catalina.sh configtest
# catalina.sh start
//客户端访问http://web1.new.com:8080 测试
# vim /etc/nginx/nginx.conf
location / {
proxy_pass http://web1.new.com:8080/;
}
# systemctl reload nginx.service
//客户端访问http://web1.new.com 测试
//动静分离,图片等静态内容保留本机服务
# vim /etc/nginx/nginx.conf
root /data/webpics/;
index index.jsp index.html
location / {
}
location ~* \.(jsp|do)$ { 模式匹配,不区分大小写,后缀以jsp和do结尾的文件
proxy_pass http://web1.new.com:8080;
}
# mkdir /data/webpics/images -pv
# systemctl reload nginx.service
//客户端访问http://web1.new.com/images/1.jpg nginx响应
//客户端访问http://web1.new.com/index.jsp tomcat响应
LAMT
client > http > httpd > reverse_proxy > {http | ajp} > tomcat (http connector | ajp connector) |
yum install httpd
httpd -M
proxy_ajp_module(shared)
反代模块 主:proxy_module 子:proxy_module_http, proxy_module_ajp
第三方模块:jk