1.去http://www.nginx.org去下载最新的服务端;
2.查找conf/nginx.conf配置文件此处用的版本为1.5.4
#user nobody;
worker_processes 1; #这里是配置的进程数据可以配一个或多个
#error_log logs/error.log;#全局错误日志及PID文件
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
#工作模式及连接数上限
events {
worker_connections 1024;
}
#设定http服务器,利用它的反向代理功能提供负载均衡支持
http {
#设定mime类型 这个可以在同一目录中找到相关的文件 下面是默认类型是以stream流行式传输,
include 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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#启用gzip压缩,这块的东西也可以做再tomcat或者是servlet 。filter中
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
#代理流转向负载均衡所需要用到的ts是自己启用的名称,weight权重负载分配比
upstream ts{
server 172.18.188.64:8080 weight=10;
server 172.18.188.76:8080 weight=20;
server 172.18.188.78:8080 weight=30;
}
server {
listen 80;#监听80端口
server_name localhost;#服务器域名如 www.abc.com
#charset koi8-r;
#access_log logs/host.access.log main;
#根目录和默认页
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#ts为代理服务
location /
{
proxy_pass http://ts;
}
#图片和静态网页存为30天
location ~ .*\.(htm|html|gif|jpg|jpeg|png|bmp|swf|ico)$
{
expires 30d;
}
#js,css存一小时
location ~ .*\.(js|css)?$
{
expires 1h;
}
# 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;
# }
#}
}
相关推荐
网上大部分关于nginx负载均衡集群的教程都是linux环境,如何实现在windows配置nginx实现负载均衡集群呢!
基于nginx tcp负载均衡 + redis的集群聊天服务器,网络层使用muduo库搭建,数据库使用MySQL 基于nginx tcp负载均衡 + redis的集群聊天服务器,网络层使用muduo库搭建,数据库使用MySQL 基于nginx tcp负载均衡 + ...
Nginx入门到精通搭建高可用集群负载均衡,Nginx+Lvs+keepAlived构建高可用集群环境
集群聊天服务器(nginx tcp负载均衡模块、muduo网络库、基于发布-订阅的redis消息队列、mysql数据库) 集群聊天服务器(nginx tcp负载均衡模块、muduo网络库、基于发布-订阅的redis消息队列、mysql数据库) 集群聊天...
基于重写的muduo网络库,并可工作于nginx tcp负载均衡环境的集群聊天服务器,使用数据库连接池访问数据库 基于重写的muduo网络库,并可工作于nginx tcp负载均衡环境的集群聊天服务器,使用数据库连接池访问数据库 ...
基于muduo库实现了工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端,采用redis消息队列进行集群,mysql数据库存储 基于muduo库实现了工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端,采用redis消息...
可以工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端源码 基于muduo库实现 redis用于服务器中间件即消息队列 mysql用于保存用户数据 可以工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端源码 基于...
可以工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端源码 基于nuduo库实现 使用了redis发布订阅消息队列 数据库采用MySQL 可以工作在nginx tcp负载均衡环境中的集群聊天服务器和客户端源码 基于nuduo库实现 ...
可以工作在 nginx tcp 负载均衡环境中的集群聊天服务器和客户端源码 基于 muduo,nginx,redis 实现 添加了数据库连接池提高了并发能力,并且降低了聊天延迟 可以工作在 nginx tcp 负载均衡环境中的集群聊天服务器和...
基于muduo网络库的集群聊天服务器和客户端源码,使用nginx tcp负载均衡,mysql 基于muduo网络库的集群聊天服务器和客户端源码,使用nginx tcp负载均衡,mysql数据库,redis发布-订阅数据库,redis发布-订阅 基于...
nginx+redis负载均衡、session共享,基于redis+tomcat实现session同步的简单demo
Nginx+tomcat配置集群负载均衡实现动静分离实例
采用nginx实现负载均衡,结合redis发布-订阅模式来实现在不同服务器上客户端进行通信。 基于moduo实现的集群聊天服务器和客户端源码,使用mysql数据库存储相关数据。采用nginx实现负载均衡,结合redis发布-订阅模式...
nginx软件负载均衡,实现各种集群服务器应用的负载均衡!
基于muduo库开发的集群聊天服务器和客户端源码,可以工作在nginx tcp负载均衡环境中,使用mysql数据库,运用了json的序列化和反序列化 基于muduo库开发的集群聊天服务器和客户端源码,可以工作在nginx tcp负载均衡...
基于nginx负载均衡的集群聊天系统,其中技术点有网络方面、数据库方面、线程安全方面;功能点有添加好友、单人聊天、群组聊天等 基于nginx负载均衡的集群聊天系统,其中技术点有网络方面、数据库方面、线程安全方面...
我们使用的是软负载均衡器Nginx,而农行用的是F5硬负载均衡器,这里简单介绍下这两种技术: a、软件负载均衡解决方案 在一台服务器的操作系统上,安装一个附加软件来实现负载均衡,如Nginx负载均衡(我们...
NULL 博文链接:https://dws.iteye.com/blog/999036
随着过去几十年互联网服务的指数增长,各大网站的访问量急剧上升。海量的用户请求使得热门网站的网络请求率可能在几秒钟内大...通过实验测试,对比不同算法下的负载均衡性能,改进后的算法能有效提高服务器集群的性能。
nginx 完成服务器之间集群的搭建 能够解决服务器调用负载均衡