ImageVerifierCode 换一换
格式:DOCX , 页数:9 ,大小:17.86KB ,
资源ID:10156058      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-10156058.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(RedHat65 Linux Nginx+Tomcat负载均衡图文详解.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

RedHat65 Linux Nginx+Tomcat负载均衡图文详解.docx

1、RedHat65 Linux Nginx+Tomcat负载均衡图文详解运维资料(最后修改时间:2015-6-24 15)目录Linux下Nginx+tomcat实现负载均衡 21.1 JDK安装 21.2 Tomcat安装 21.2.1 指定JDK 21.2.2 修改端口号 21.3 Nginx安装 41.3.1 安装prce包 41.3.2 安装Nginx 51.4 Nginx配置修改 61.4.1 proxy.conf 61.4.2 gzip.conf 61.4.3 nginx.conf 61.5 负载均衡测试 10Linux下Nginx+tomcat实现负载均衡Linux下利用Nginx

2、+tomcat实现负载均衡,本次配置如下10.161.200.90:nginx服务器端口:8010.161.200.91:tomcat1服务器端口:808010.161.200.92:tomcat2服务器端口:80801.1 JDK安装Linux系统在不清楚具体部署了那些程序之前最好不要用“.bin”格式的JDK安装文件自动安装。此操作会更改到其他用户默认环境。一般选择解压包方式安装,然后在应用程序上直接指定JDK路径。将jdk-7u51-linux-x64.tar.gz上传到91、92服务器并执行以下语句tarxvzf jdk-7u51-linux-x64.tar.gz为方便管理,将解压出的

3、文件夹移动到/opt下并更名为jdk1.71.2 Tomcat安装将apache-tomcat-7.0.53上传到需要应用服务器(10.161.200.91以及10.160.121.200.92)unzip apache-tomcat-7.0.53为方便管理,将解压出的apache-tomcat-7.0.53文件夹复制到/home文件夹下并更名为tomcat7_v31.2.1 指定JDK进入/home/tomcat7_v3/bin,修改catalina.sh文件如下# OS specific support. $var _must_ be set to either true or false

4、.JAVA_HOME=/opt/jdk1.7 #加入jdk路径1.2.2 修改端口号如果每个Tomcat在不同服务器上则不需要更改端口号,反之则需要修改。进入/home/tomcat7_v3/conf/ 修改server.xml文件,第一处修改(修改时最好按照tomcat顺序,不易出错):第一个tomcat默认全部不修改剩下的Tomcat依次修改为8105、8205、8305第二处修改:第一个tomcat默认全部不修改,剩下的Tomcat依次修改为(8180,8444)、(8280,8445)、(8380,8446)第三处修改:第一个tomcat默认全部不修改,剩下的Tomcat依次修改为(8

5、109,8444)、(8209,8445)、(8309,8446)第四处修改:所有得Tomcat依次修改为tomcat1、tomcat2、tomcat3完成后启动tomcat分别访问http:/localhost:prot以及可以看见tom猫表示tomcat部署成功1.3 Nginx安装1.3.1 安装prce包Prce包为Nginx正则表达式支持包,将pcre-8.35.tar.gz上传到服务器/soft目录下(该包为nginx依赖包)tarxvzfpcre-8.35.tar.gzcd pcre-8.35./configure MakeMake install1.3.2 安装Nginxtar

6、xvzfnginx-1.6.0.tar.gzcd nginx-1.6.0./configure -prefix=/opt/nginxmakemake install安装完成后进入/opt/nginx/sbin目录Cd /opt/nginx/sbinnginx或者opt/nginx/sbin/nginx注:redhat 64位机器上nginx可能会读取pcre文件为/lib64/libpcre.so.1文件,所以需要做一个软连接:lns /usr/local/lib/libpcre.so.1 /lib64/在启动nginx(nginx启动不会有任何反馈信息)在浏览器地址栏输入http:/loca

7、lhost提示its work 或者是nginx的欢迎页面表示成功1.4 Nginx配置修改1.4.1 proxy.conf在conf文件夹下新建proxy.conf文件并加入如下代码proxy_redirect off;proxy_set_header Host $host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;client_max_body_size 10m;client_body_buffer_size 128k;proxy_c

8、onnect_timeout 300;proxy_send_timeout 300;proxy_read_timeout 300;proxy_buffer_size 4k;proxy_buffers 4 32k;proxy_busy_buffers_size 64k;proxy_temp_file_write_size 64k;1.4.2 gzip.conf在conf文件夹下新建gzip.conf文件并加入如下代码gzip on;gzip_min_length 1000;gzip_types text/plain text/cssapplication.x-javascript;1.4.3 n

9、ginx.conf打开nginx.conf修改如下#user nobody;worker_processes4;#nginx进程数,建议设置为等于CPU总核心数error_log logs/error.log;#取消本行及以下三行注释error_log logs/error.log notice;error_log logs/error.log info;pid logs/nginx.pid;#单个进程最大连接数(最大连接数=连接数*进程数)events worker_connections 1024;#设定http服务器http includemime.types;default_type

10、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 on; #取消注释server

11、listen 80 default;server_namelocalhost; #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

12、; # 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_indexindex.php; # fastcgi_param SCRIPT_FILENAME

13、 /scripts$fastcgi_script_name; # include fastcgi_params; # # deny access to .htaccess files, if Apaches document root # concurs with nginxs one # #location /.ht # deny all; # # another virtual host using mix of IP-, name-, and port-based configuration # #server # listen 8000; # listen somename:8080;

14、 # server_namesomename alias another.alias; # location / # root html; # index index.html index.htm; # # # upstream的负载均衡,weight是权重,可以根据机器配置定义权重。weigth参数表示权值,权值越高被分配到的几率越大,此处为配置权值,默认为轮巡方式。upstreamlocalhost #ip_hash; server 192.168.56.102:8180; #server ip:prot weight;server 192.168.56.102:8280; server

15、listen 80; #nginx监听端口server_name 192.168.56.102; #nginx服务名location / proxy_connect_timeout 3; proxy_send_timeout 30; proxy_read_timeout 30; proxy_pass http:/localhost; #nginx监听地址 # HTTPS server # #server # listen 443 ssl; # server_namelocalhost; # ssl_certificatecert.pem; # ssl_certificate_keycert.k

16、ey; # 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; # #完成以上配置后执行以下代码检测配置opt/nginx/sbin/nginx -t若检测通过这杀掉nginx进程重新启动nginx1.5 负载均衡测试最简单的测试为:修改tomcat1以及tomcat2的index.jsp的内容。然后新建多个会话访问10.161.200.90若tomcat首页不同这表示负载均衡配置成功。至此,本次配置结束

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2