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负载均衡
原文地址:https://www.cnblogs.com/xiaowenshu/p/10099119.html