来自server+iis  linux可做参考 :

#user  nobody;
worker_processes 8; #worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; worker_rlimit_nofile 102400;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info; #pid logs/nginx.pid; events {
use epoll;
worker_connections 102400;
} http {
include mime.types;
default_type application/octet-stream;
#proxy_cache_path d:\imgdata\cache levels=1:2 keys_zone=imgcache:100m inactive=1d max_size=10g;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on;
#tcp_nopush on; #keepalive_timeout 0;
keepalive_timeout 65;
client_header_buffer_size 8k;
client_max_body_size 24m; gzip on; upstream www.yunxindai.com{ #server ip1:8080 weight=1 max_fails=2 fail_timeout=30s;
server ip2:80 weight=3 max_fails=2 fail_timeout=30s;
#server ip3:80 weight=3 max_fails=2 fail_timeout=30s;
server ip4:80 weight=3 max_fails=2 fail_timeout=30s;
server ip5:80 backup;
#server ip6:80 weight=3 max_fails=2 fail_timeout=30s;
ip_hash;
} #domain tiaozhuan
server {
listen 80;
server_name www.xx.net;
server_name www.xx.cn;
server_name xx.com;
#server_name www.xx.com.cn;
rewrite
^/(.*) http://www.yunxindai.com/$1 permanent;
} server {
listen 80;
server_name ip1;
server_name www.xx.com;
#server_name www.xx.cn;
server_name www.xx.com.cn;
#server_name www.xx.net; #charset koi8-r; #access_log logs/host.access.log main; location / {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_pass http://www.yunxindai.com;
#proxy_redirect default;
proxy_redirect off;
proxy_set_header x-real-ip $remote_addr;
proxy_set_header remote-host $remote_addr;
proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for;
} #error_page 404 /404.html; # redirect server error pages to the static page /50x.html
#
error_page 404 500 502 503 504 /50x.html;
location = /50x.html {
root html;
} # proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#} # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} # another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias; # location / {
# root html;
# index index.html index.htm;
# }
#} # HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost; # ssl_certificate cert.pem;
# ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on; # location / {
# root html;
# index index.html index.htm;
# }
#} }

本人配置如下:

user  nginx;
worker_processes 8;
worker_rlimit_nofile 51200; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; events {
use epoll;
worker_connections 51200;
} http {
include /etc/nginx/mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on;
#tcp_nopush on; keepalive_timeout 65; #gzip on; include /etc/nginx/conf.d/*.conf; #设定负载均衡的服务器列表
upstream myServer {
#weigth参数表示权值,权值越高被分配到的几率越大
#本机上的apache开8080端口
server ip1:8080 weight=4 max_fails=2 fail_timeout=25s;
server ip2:80 weight=6 max_fails=2 fail_timeout=25s;
ip_hash;
} server {
listen 80;
server_name 域名; #可加多个域名
server_name ip1;
location / {
proxy_pass http://myServer;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr; #应用服务器上显示正式客户端ip }
}
}

nginx负载 发向代理配置文件参考的更多相关文章

  1. nginx负载均衡(反向代理)

    6,安装nginx 6.1 依赖库安装  要安装在root根目录里,不要装在虚拟环境里面 yum install gcc-c++ pcre pcre-devel zlib zlib-devel ope ...

  2. 架构之Nginx(负载均衡/反向代理)

    Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器 ,也是一个 IMAP/POP3/SMTP 代理 服务器 . Nginx 是由 Igor Sys ...

  3. nginx 负载均衡 反向代理

    nginx 通过方向代理实现负载均衡,负载均衡是大流量网站要做的措施,单从字面上的意思来理解为N台服务器平均分担负载,不会因为某一台服务器负载高宕机而影响用户访问网站,负载均衡至少需要三台服务器, 既 ...

  4. Nginx负载均衡反向代理 后端Nginx获取客户端真实IP

    Nginx 反向代理后,后端Nginx服务器无法正常获取客户端的真实IP nginx通过http_realip_module模块来实现的这需要重新编译,如果提前编译好了就无需重新编译了1,重新编译ng ...

  5. keepalived + nginx(负载均衡反向代理HTTP,https) + tomcat(HTTP,https)

    基本架构: nginx(192.168.116.198) client        --->keepalived(116.200)      ------> tomcat (192.16 ...

  6. Nginx负载均衡反向代理

    http{ upstream test.com { server 118.118.66.88:8080; } server { listen 80; server_name www.test.com; ...

  7. 解析nginx负载均衡

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://baidutech.blog.51cto.com/4114344/1033718 ...

  8. nginx负载均衡集群(二)

    nginx负载均衡配置实战 一.配置基于域名虚拟主机的web节点 web02和web01做同样的操作,nginx配置文件如下: [root@web01 conf]# cat nginx.conf wo ...

  9. SqlServer 更改复制代理配置文件参数及两种冲突策略设置

    原文:SqlServer 更改复制代理配置文件参数及两种冲突策略设置 由于经常需要同步测试并更改代理配置文件属性,所以总结成脚本,方便测试. 可更新订阅的冲突策略有两种情况:一是在发布中冲突,即订阅数 ...

随机推荐

  1. A Byte of Python 笔记(12)python 标准库:sys、os,更多内容

    第14章 python 标准库 Python标准库是随Python附带安装的,它包含大量极其有用的模块. sys 模块 sys 模块包含系统对应的功能.如 sys.argv 列表包含命令行参数. # ...

  2. Android UiAutomator 自动化测试环境搭建---新手1

    1.首先需要准备的工具有 1.java jdk 2. android开发工具 adt 3.ant 安装包(如果下载adt里面有) 2.首先安装java环境,jdk这个百度就可以了. 3.android ...

  3. net-snmp启用python模块

    1. http://blog.jeoygin.org/2011/09/centos-5-install-python-2-6-and-python-setuptools-2-6.html 2. htt ...

  4. php中 $$str 中 "$$" 的解释

    原文:php中 $$str 中 "$$" 的解释 这种写法称为可变变量有时候使用可变变量名是很方便的.就是说,一个变量的变量名可以动态的设置和使用.一个普通的变量通过声明来设置,例 ...

  5. python使用easygui写图形界面程序

    我 们首先下载一个类库easygui,它是一个Python用于简单开发图形化界面的类库,打开easygui的下载网页 http://sourceforge.net/projects/easygui/? ...

  6. BZOJ 1008 越狱 (组合数学)

    题解:正难则反,从总数中减去全部相邻不相同的数目就是答案,n*(n-1)^(m-1):第一个房间有n中染色方案,剩下m-1个房间均只有n-1种染色方案,用总数减就是答案. #include <c ...

  7. ubuntu安装hadoop 若干问题的解决

    问题1:安装openssh-server失败 原因: 下列软件包有未满足的依赖关系: openssh-server : 依赖: openssh-client (= 1:5.9p1-5ubuntu1) ...

  8. C语言数据结构----双向链表

    概括:主要说明双向链表的基本概念和具体操作以及源代码. 一.基本概念 1.有了单链表以后我们可以把内存中小块的空间联系在一起,并且把每一个小块都存储上我们想要存储的数值.但是单链表只有一个next,我 ...

  9. DevExpress ASP.NET 使用经验谈(6)-ASPxGridView属性设置与CRUD界面优化

    上一节中,我们通过简单的配置,通过ASPxGridView控件的使用,完成了对数据库表的CRUD操作. 这样的界面展现,功能是达到了,但是操作体验上,还是有所欠缺的. 图一 默认生成的列表界面 图二 ...

  10. hdu 4782 Beautiful Soupz

    模拟.其实这题就是题目比较长而已...读完题目就差不多了.tag直接读就可以了,题目说了不用修改.然后整个题目就是让求text部分,严格按空格分开.注意每行前面空格个数. #include<al ...