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

阿里云

相关推荐
snow@li20 分钟前
协议:应用层开发都会涉及哪些协议 / 详细整理 / http、ws、https、wss
网络协议·http·https
NGINX开源社区40 分钟前
从 F5 NGINX Ingress Controller 迁移到 F5 NGINX Gateway Fabric
nginx
鬼先生_sir42 分钟前
Spring Cloud LoadBalancer 详解:从原理到生产实战(2026最新版)
spring cloud·负载均衡·loadbalancer
foxsen_xia2 小时前
Kamailio脚本实现动态路由负载均衡与灰度发布
负载均衡·信息与通信
星辰_mya2 小时前
深度全面学习负载均衡Ribbon/Spring Cloud LoadBalancer
后端·spring cloud·面试·负载均衡·架构师
952363 小时前
网络原理 - HTTP / HTTPS
网络·http·https
Arvin62715 小时前
Nginx 添加账号密码访问验证
运维·服务器·nginx
阿凤2119 小时前
nginx部署如何配置ssl证书
运维·nginx·ssl
zhyoobo20 小时前
Nginx Gzip压缩全解析:原理、配置与性能优化指南
运维·nginx·性能优化
chxii21 小时前
Nginx的缓存配置--客户端缓存 (Browser Caching)和代理服务器缓存 (Proxy Server Caching)
nginx·缓存