nginx 配置nginx.conf,负载均衡,逻辑分流
来源:互联网 发布:淘宝优惠券qqfxb 编辑:程序博客网 时间:2024/04/29 03:43
nginx 最重要的配置文件nginx.conf:
一般的配置我不做解释,网上到处都是,主要对主要的几点进行注释(如下)
worker_processes 8;
error_log /data/logs/nginx_error.log crit;
worker_rlimit_nofile 655350;
events {
use epoll;
worker_connections 10240;
}
http {
sendfile on;
#tcp_nopush on; //这是不作缓冲数据的设置,对于play framework这种需要宽进快出的web-server construction 需要屏蔽掉
#tcp_nodelay on;//同上
keepalive_timeout 65;//超时时间
types_hash_max_size 2048;
limit_zone one $binary_remote_addr 10m;
client_max_body_size 30m;
include mime.types;
default_type application/octet-stream;
access_log /data/logs/access.log;
//以下是压缩相关配置
gzip on;
gzip_min_length 1000;
gzip_buffers 4 8k;
gzip_types text/plain application/x-javascript text/css application/xml;
upstream web {
server 127.0.0.1:8080;
}
//定义一组服务器
upstream api {
server 127.0.0.1:9000;
server 127.0.0.1:9003;
}
//定义一组服务器
upstream api1 {
server 10.200.57.155:9000;
server 127.0.0.1:9004;
}
//.....
upstream admin {
server 127.0.0.1:9002;
}
.......
//监听端口
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/cacert.pem;
ssl_certificate_key /etc/ssl/privkey.pem;
server_name api.fastooth.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Refer $http_referer;
//根据请求的url进行分流,可以直接进行返回http status
if ( $uri ~* (.*)(location) ) {
return 200;
break;
}
//根据请求的url进行分流,选择不同的服务器
if ( $uri ~* (.*)(dealMessage) ) {
proxy_pass http://api1;
}
if ( $uri ~* (.*)(runLog) ) {
proxy_pass http://api1;
}
proxy_pass http://api;
proxy_pass https://223.4.174.21;
}
}
}
- nginx 配置nginx.conf,负载均衡,逻辑分流
- Nginx负载均衡conf配置
- nginx.conf负载均衡配置
- nginx 负载均衡配置方法 nginx.conf
- nginx 配置轮询分流-实现负载均衡【测试通过】
- nginx 配置轮询分流-实现负载均衡
- nginx + tomcat 实现负载均衡配置 nginx.conf配置
- nginx.conf详细说明和负载均衡配置
- nginx 负载均衡配置
- nginx配置负载均衡
- nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- Nginx负载均衡配置
- nginx负载均衡配置
- Nginx 负载均衡配置
- nginx负载均衡配置
- nginx负载均衡配置
- CRT的多线程困扰
- tomcat安装服务和内存参数设置
- Android系统中 webkit 内核浏览器position:fixed所造成的兼容问题
- blas相关工具
- 开源软件
- nginx 配置nginx.conf,负载均衡,逻辑分流
- Oracle10g在Windows2008上安装
- uva 10591 - Happy Number hash
- 部分排序
- crtmpserver流媒体服务器的介绍与搭建
- jqGrid -- 方法
- hibernate学习笔记10-2
- 个人站长的廉价劳动力
- ios 属性和实例变量的区别