码迷,mamicode.com
首页 > 系统相关 > 详细

Linux配置Nginx+Tomcat负载均衡

时间:2018-12-10 22:05:33      阅读:322      评论:0      收藏:0      [点我收藏+]

标签:blank   解决方法   zlib   pcre   解决   Fix   伪静态   without   分享   

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负载均衡

标签:blank   解决方法   zlib   pcre   解决   Fix   伪静态   without   分享   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!