Nginx

高性能静态http服务器,用于为tomcat服务器集群提供反向代理服务,实现高并发的负载均衡

依赖:pcre、pcre-devel、zlib、zlib-devel、openssl、openssl-devel、GCC、G++

常用命令

nginx -s stop
nginx -s quit
nginx -s reload
#启动
nginx -c /path/to/nginx.conf
#平滑重启
kill -HUP 主进程号

#因为老版本没有卸载干净的原因,配置文件很乱,实际起作用的配置文件为/etc/nginx/sites-available/default

#window强制停止: taskkill /f /t /im nginx.exe

window域名映射

修改C:\Window\System32\dirvers\etc\hosts配置文件

Nginx反向代理

配置信息

upstream tomcat-travel{
    server 代理IP:端口号 weight=2;#负载权重设置,默认为1。在这种情况下就是50% 25% 25%的比例
    server 代理IP2:端口号;#负载均衡
}
server{
    listen 80;
    server_name 域名;【默认localhost】

    location/{
        #root index;【这里表示本机Nigix根目录下的index文件夹】
        proxy_pass http://tomcat-travel;#代理设置
    	index index.html index.htm;#默认访问资源名称
    }
}

压测工具

Redis:redis-benchmark

WEB:Jmeter

 posted on 2022-03-18 13:42  春秋流千事  阅读(50)  评论(0)    收藏  举报