Nginx
1、反向代理和负载均衡
upstream httpds { server 192.168.44.102 weight=8 down; server 192.168.44.103:8080 weight=2; server 192.168.44.104:8080 weight=1 backup; } location / { rewrite ^/([0-9]+).html$ /index.jsp?pageNum=$1 redirect; proxy_pass http://httpds ; }
2、动静分离
配置,在proxy_pass写上tomcat的ip地址
使用正则匹配动静分离
3、URLRewrite
upstream httpds { server 192.168.44.102 weight=8 down; server 192.168.44.103:8080 weight=2; server 192.168.44.104:8080 weight=1 backup; } location / { rewrite ^/([0-9]+).html$ /index.jsp?pageNum=$1 redirect;//URLRewrite proxy_pass http://httpds ; }
4、防盗链的配置
valid_referes引用表示只有本机才可以访问,其他主机proxy_pass访问则会被拦截
在加入none后,用refere引用访问不到,但是直接访问可以访问的到
5、高可用keepalive