Nginx 基础应用实战 03 基于反向代理的负载均衡、https配置

Nginx 基础应用实战 03

反向代理

proxy_pass http://baidu.com;

复制代码
        location /mashibing {
           
	proxy_pass http://mashibing.com/;
        }

基于反向代理的负载均衡

复制代码
  upstream httpd {
    server 192.168.43.152:80;
    server 192.168.43.153:80;
}
weight(权重)

指定轮询几率,weight和访问比率成正比,用于后端服务器性能不均的情况。

复制代码
upstream httpds {
    server 127.0.0.1:8050       weight=10 down;
    server 127.0.0.1:8060       weight=1;
     server 127.0.0.1:8060      weight=1 backup;
}
  • down:表示当前的server暂时不参与负载
  • weight:默认为1.weight越大,负载的权重就越大。
  • backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。

代理服务的安全问题

在公网配置HTTPS

Nginx配置

复制代码
     server {
             listen       443 ssl;
             server_name  aa.abc.com;

             ssl_certificate      /data/cert/server.crt;
             ssl_certificate_key  /data/cert/server.key;

     }

免费签名

https://freessl.cn

阿里云

相关推荐
HelloWorld工程师11 分钟前
新手如何快速申请SSL通配符证书...
网络协议·https·ssl
酷炫的水壶3 小时前
使用memc-nginx和srcache-nginx模块构建高效透明的缓存机制
运维·nginx·缓存
姚不倒5 小时前
F5 SSL Profile 证书卸载深入篇
运维·网络协议·负载均衡·ssl·f5
智商偏低5 小时前
Windows Nginx 完整安装 + 启动教程
运维·nginx
oscar9999 小时前
3.4 Nginx 负载均衡——动态再平衡的反人性纪律
nginx·github·负载均衡·财富源代码
姚不倒11 小时前
F5 健康检查 Monitor 深入篇
运维·负载均衡·f5
川石课堂软件测试11 小时前
性能测试|Nginx中间件监控与调优
linux·python·nginx·中间件·单元测试·压力测试·harmonyos
m0_7408596221 小时前
Nginx进行配置文件拆分(以windows解压版为例)
nginx
开发小程序的之朴1 天前
认识安企CMS-安装安企CMS的环境要求
nginx·golang·系统架构
考虑考虑1 天前
nginx配置ssl
运维·后端·nginx