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

阿里云

相关推荐
tjsoft36 分钟前
设置 windows nginx.exe 每天 重启
运维·windows·nginx
舰长1152 小时前
nginx 负载均衡配置
运维·nginx·负载均衡
BenChuat16 小时前
使用 httpsok 给 QNAP NAS 添加阿里云域名的永久免费 HTTPS(SSL)证书
阿里云·https·ssl
全栈小516 小时前
【小程序】微信开发者工具上调用api接口可以,到了线上调用发现提示wx.request调用报错,原来是https协议问题
网络协议·小程序·https
foundbug99917 小时前
查看nginx日志文件
linux·nginx·github
一只程序烽.19 小时前
java项目使用宝塔面板部署服务器nginx不能反向代理找到图片资源
java·服务器·nginx
福大大架构师每日一题1 天前
nginx 1.29.2 发布:AWS-LC 支持、QUIC及SSL优化等重要更新
nginx·ssl·aws
金色天际线-1 天前
nginx + spring cloud + redis + mysql + ELFK 部署
redis·nginx·spring cloud
帅帅梓2 天前
nginx访问控制 用户认证 https
运维·nginx·https
有谁看见我的剑了?2 天前
k8s ingress-nginx 学习
学习·nginx·kubernetes