首页 > 系统服务 > 详细

Linux配置Nginx+Tomcat负载均衡

时间:2018-12-10 21:24:41      阅读:217      评论:0      收藏:0      [点我收藏+]

tar -zxvf nginx-1.14.2.tar.gz -C /usr/local

一、Linux配置Nginx

一、下载Nginx

  方式1:从http://nginx.org/en/download.html上下载稳定版,解压安装

技术分享图片

 

  方式2:直接在Linux上用命令下载: wget http://nginx.org/download/nginx-1.10.2.tar.gz
  -bash: wget: command not found

  安装wget:
  yum -y install wget

  再执行下载nginx

二、解压安装包&重命名   

  tar -zxvf nginx-1.14.2.tar.gz -C /usr/local

  mv nginx-1.14.2 nginx

三、编译

  1、cd 到nginx目录下

技术分享图片

  2、安装相关组件

  • yum install -y pcre pcre-devel
  • yum install -y zlib zlib-devel
  • yum install -y openssl openssl-devel

技术分享图片

  这是提示缺少c++环境 ,用 yum install gcc-c++ 安装一下,再执行 ./configure,然后又报错了:

技术分享图片

 

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.

没装伪静态模块需要pcre库
解决方法:
yum install -y pcre pcre-devel

还有可能出现:
错误提示:./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library. You can either disable the module by using
–without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
–with-http_ssl_module –with-openssl= options.

解决办法:
yum -y install openssl openssl-devel

最后 ./configure

 技术分享图片

执行make 编译:

技术分享图片

然后:make install  报错:

技术分享图片

 

 问题原因: 直接把安装包重命名成nginx了,安装文件没有路径了。

解决办法如下:

删除nginx 文件夹
rm -rf nginx

重新解决源码
tar -zxvf nginx-1.10.2.tar.gz

cd /usr/local/nginx-1.10.2

生成Makefile文件

  ./configure --prefix=/usr/local/nginx

编译源码
make

安装
make install

 

 

二、Linux配置Tomcat

三、Nginx配置Tomcat负载均衡

Linux配置Nginx+Tomcat负载均衡

原文:https://www.cnblogs.com/xiaowenshu/p/10099119.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!