目录
一、概述
所谓的LNMT架构指的就是Linux操作系统上部署Nginx web服务器、MySQL数据库服务器、Tomcat中间件服务器。
L linux
N nginx
M mysql
T tomcat
A apache
P PHP
二、反向代理负载均衡
配置nginx
写到http区域 (轮询)默认 upstream tomcat { server 192.168.255.138:8080; server 192.168.255.138:8081; }
写到http区域 (加权轮询) upstream tomcat { server 192.168.255.138:8080 weight=1; server 192.168.255.138:8081 weight=2; }
写到server字段 location / { root /usr/share/nginx/html; proxy_pass http://tomcat; # porxy_set_hrader Host $host; }
三、动静分离
配置nginx
location ~\.jsp$ { proxy_pass http://tomcat; proxy_set_header Host $host; } location / { root /usr/share/nginx/html; index index.html; }
重启服务!!!