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

阿里云

相关推荐
还是大剑师兰特15 小时前
解决nginx错误:http://localhost:7000正常,http://localhost:7000/map 报错404
nginx·大剑师
xing-xing18 小时前
Docker容器中Nginx站点根目录网页配置访问
nginx·docker
2501_9160074720 小时前
苹果商店iOS应用上架费用全面解析:开发者计划与审核费用计算
android·ios·小程序·https·uni-app·iphone·webview
Lsetea20 小时前
证书没到期却报certificate has expired:OpenSSL定位中间证书与系统时间
运维·https·ssl证书·openssl·证书链
PC2005-cloud21 小时前
Nginx 防盗链配置实战:用 referer 模块保护网站静态资源
nginx
2501_916008891 天前
如何实现iOS App代码混淆:SwiftShield使用指南
android·ios·小程序·https·uni-app·iphone·webview
SDWAN_Cheap1 天前
HTTPS到底加密了什么?
https·数据加密
PHP实战开发录1 天前
Nginx上传大文件为什么报413
nginx·php·开发
2501_916008891 天前
怎么用 Godot 导出 iOS 应用并上架 App Store?签名字段该填什么?
android·ios·小程序·https·uni-app·iphone·webview
Lsetea2 天前
Nginx报No required SSL certificate was sent:mTLS客户端证书排查
运维·nginx·https·ssl·openssl