LNMT:
client->http->nginx->reverse_proxy->http->tomcat(httpconnector)
在Nginx上配置反向代理访问后端的tomcat
#location / {
# proxy_pass http://192.168.2.120:8080; 如果后端有虚拟主机,访问默认的虚拟主机
# proxy_pass http://www.linuxmysql.com:8080;} 访问与servername匹配的主机
动静分离:
动态内容访问tomcat服务器
Location~* \.(jsp|do)$ {
Proxy_pass http://www.linuxmysql.com:8080;
}
LAMT:
Client->http ->httpd ->reverse_proxy ->(http|ajp) ->tomcat(httpconnector|ajp connector)
反向代理模块:
主模块:proxy_module
子模块:proxy_module_http基于http协议
Proxy_module_ajp 基于ajp协议
第三方模块:
jk模块基于ajp协议
反向代理配置:
基于proxy_module_http模块
vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
ServerName linuxmysql.com
ProxyVia On #httpd通过当前主机反向代理
ProxyRequests Off #正向代理关闭
ProxyRreserveHost On #支持后端基于主机名的虚拟主机
#会将客户端的域名带到后端的基于域名的虚拟主机,后端匹配基于域名的虚拟主机s
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://www.linuxmysql.com:8080/
ProxyPassReverse/ http://www.linuxmysql.com:8080/
<Location / >
Require all granted
</location>
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
基于proxy_module_http模块
vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
ServerName linuxmysql.com
ProxyVia On #httpd通过当前主机反向代理
ProxyRequests Off #正向代理关闭
ProxyRreserveHost On #支持后端基于主机名的虚拟主机
#会将客户端的域名带到后端的基于域名的虚拟主机,后端匹配基于域名的虚拟主机s
<Proxy *>
Require all granted
</Proxy>
ProxyPass /status ! #访问/status不做反向代理
ProxyPass / ajp://www.linuxmysql.com:8009/
ProxyPassReverse/ ajp://www.linuxmysql.com:8009/
<Location / >
Require all granted
</location>
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
LNAMT:
Client->http ->Nginx ->reverse_proxy ->(http|ajp) ->[httpd(http proxy)+tomcat connector)]
另一台主机上 在同一台主机上