Nginx
来源:互联网 发布:王子长 知乎 编辑:程序博客网 时间:2024/05/29 23:22
Nginx命令参数
nginx -t 测试配置是否正确
nginx -s reload 加载最新配置
nginx -s stop 立即停止
nginx -s quit 优雅停止
nginx -s open 重新找开日志
./sbin/nginx 启动
反向代理
配置如下:代理服务器通过设置头信息字段,把用户IP传到后台服务去
localtion ~ \.(jpg|jpeg|png|gif)$ {
proxy_set_header X-Forworded-For $remote_addr;
proxy_pass IP:port;
}
集群(负载均衡)
upstream imgserver{
server 192.168.2.42:80 weigth=1 max_fails=2 fail_timeout=30s;
server 192.168.2.43:80 weigth=1 max_fails=2 fail_timeout=30s;
}
localtion ~ \.(jpg|jpeg|png|gif)$ {
proxy_set_header X-Forworded-For $remote_addr;
proxy_pass http://imgserver;
nginx -t 测试配置是否正确
nginx -s reload 加载最新配置
nginx -s stop 立即停止
nginx -s quit 优雅停止
nginx -s open 重新找开日志
./sbin/nginx 启动
反向代理
配置如下:代理服务器通过设置头信息字段,把用户IP传到后台服务去
localtion ~ \.(jpg|jpeg|png|gif)$ {
proxy_set_header X-Forworded-For $remote_addr;
proxy_pass IP:port;
}
集群(负载均衡)
upstream imgserver{
server 192.168.2.42:80 weigth=1 max_fails=2 fail_timeout=30s;
server 192.168.2.43:80 weigth=1 max_fails=2 fail_timeout=30s;
}
localtion ~ \.(jpg|jpeg|png|gif)$ {
proxy_set_header X-Forworded-For $remote_addr;
proxy_pass http://imgserver;
}
默认的负载均衡算法:是设置计数器,轮流请求N台服务器
可以安装第三方利用不同参数把请求均衡到不同服务器去:
1.基于cookie值区别用户做负载均衡
2.基于URI利于一致性哈希算法做均衡
3.基于IP做负载均衡
阅读全文
0 0
- nginx
- Nginx
- Nginx
- Nginx
- Nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- nginx
- Nginx
- nginx
- nginx
- nginx
- nginx
- Web前端-HeadFirst笔记-CH10 span div 伪类
- 支持向量机通俗导论(理解SVM的三层境界)
- java拷贝
- Spark在不同集群中的运行演示
- 3.单一职责模式
- Nginx
- tiny4412学习(三)之移植linux-4.x驱动(1)支持网卡驱动
- 在bootstrap的table表格中,设置文本内容居中
- 懒加载
- BZOJ 1497: [NOI2006]最大获利
- 产业物联网如何实现价值?
- okhttp 2.x 用法/封装
- 4.开放封闭原则
- 微信小程序编辑器bug:wx.showToast下image无法识别同名图片文件的更改