Nginx 负载均衡器(1+2)
0.准备过程
useradd www mkdir -p /data/logs/ chown -R www:www /data/logs/ ulimit -SHn 102400
1.安装 pcre
tar zxvf pcre-8.20.tar.gz cd pcre-8.20 ./configure make && make install
2.安装nginx
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
3.修改nginx配置文件
user www www; worker_processes 2; pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events {use epoll;worker_connections 51200; } http {include mime.types;default_type application/octet-stream;charset utf-8;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;sendfile on;tcp_nopush on;keepalive_timeout 60;tcp_nodelay on;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;upstream www.free.com {ip_hash;server 192.168.18.213:80;server 192.168.18.214:80;}#access loglog_format access '$remote_addr - $remote_user [$time_local] "$request" ''$status $body_bytes_sent "$http_referer" ''"$http_user_agent" "$http_x_forwarded_for"';access_log /data/logs/access.log access;server {listen 80;server_name www.free.com;location /{proxy_pass http://www.free.com;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;}#开启监控功能location /nginx{ access_log off;stub_status on;}} }
4.检查配置文件
/usr/local/nginx/sbin/nginx -t
5.启动nginx
/usr/local/nginx/sbin/nginx
6.重启加载配置文件
/usr/local/nginx/sbin/nginx
-s reload
转载于:https://blog.51cto.com/jinmy/1266270
Nginx 负载均衡器(1+2)相关推荐
- 监控Nginx负载均衡器脚本
1.编写脚本 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 vim nginx_pid.sh #!/bin/bash while : do nginxpid=`ps -C ...
- nginx负载均衡器处理session共享的几种方法(转)
1) 不使用session,换作cookie 能把session改成cookie,就能避开session的一些弊端,在从前看的一本J2EE的书上,也指明在集群系统中不能用session,否则惹出祸端来 ...
- Nginx 高可用集群解决方案 Nginx + Keepalived
点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试资料 作者:10pcm 链接:https://blog.51cto.co ...
- 关于Nginx的limit_conn模块的思考
根据Nginx的官方WIKI记载,此模块能够限制单IP的并发访问数,乍看此模块如果强大,简直是应用级的iptables嘛,正准备用于自己线上的服务器,但仔细一想,发现还是不是太实用,我们最前面一般都有 ...
- Nginx+keepalived负载均衡高可用篇第③版
Nginx+keepalived负载均衡高可用篇第③版 对付中.小型企业,假如没有资金去购买昂贵的四/七层负载均衡交换机,那么Nginx是不错的七层负载均衡选择,并且可以通过Nginx + Keepa ...
- Nginx主主负载均衡架构
在和一些朋友交流Nginx+Keepalived技术时,我虽然已成功多次实Nginx+Keepaived项目方案,但这些都是用的单主Nginx在工作,从Nginx长期只是处于备份状态,所以我们想将二台 ...
- 单一nginx负载均衡+LNMP分布式架构
随着互联网的快速发展,我们的web站点访问量和数据流量的快速增长,对于我们服务器的处理能里的要求也越来越高,这样的情况下,单一的服务器根本无法承受, 这样的话我们丢弃掉原有的设备,做硬件升级,会造成 ...
- nginx实现tomcat的负载均衡及企业内部应用的代理
192.168.3.87 mysql+redis+tomcat 192.168.3.112 nginx:6688 192.168.3.86 nginx+h5 环境准备 a.安装包 open jd ...
- Linux之nginx入门
nginx入门 详见可参考:https://www.cnblogs.com/tiger666/p/10239307.html?tdsourcetag=s_pctim_aiomsg 1. 常用的WEB框 ...
最新文章
- Linux安装图解全过程(Linux Text文本界面安装)
- 杭州java班学费多少_杭州学java费用多少
- python3射线法判断点是否在多边形内
- 1067: [SCOI2007]降雨量
- 【CF - 699C】 Vacations (日程安排 dp)
- Mac OS 看机起动JIRA
- 数据结构例程——哈希表及其运算的实现
- yaml 数组_使用 YAML 保存游戏数据 !
- 风控报表课程正式开启
- 地图旋转_人类一败涂地手游:地图冰进阶攻略,团队配合与齐心协力缺一不可...
- Caffe傻瓜系列(4):其它常用层及参数
- 阶段3 2.Spring_03.Spring的 IOC 和 DI_9 spring的依赖注入
- 微服务测试:如何破解测试所面临的问题?测试的类型和范围你懂吗
- 《程序员必读之软件架构》作者Simon Brown:架构师与程序员的区别
- JZOJ100047. 【NOIP2017提高A组模拟7.14】基因变异
- 抽奖逻辑java_Java 利用binarySearch实现抽奖计算逻辑
- 谷歌浏览器旧版本下载地址
- html win10虚拟键盘,Win10怎么调出虚拟键盘
- html/template
- Word文件怎么打印