nginx安装及安装问题记录

##安装包下载

Nginx安装包:选择最新的即可
http://nginx.org/en/download.html
本次下载的是:nginx-1.19.0.tar.gz

Pcre下载界面:选择pcre最新的安装包即可
https://ftp.pcre.org/pub/pcre/
本次下载的是:pcre-8.44.tar.gz

安装pcre步骤

安装前可用rpm命令确认是否已安装,如下是有安装的则无需安装
$ rpm -qa|grep pcre
pcre-7.8-6.el6.x86_64
pcre-devel-7.8-6.el6.x86_64

如未安装则参考如下步骤:
解压安装包:
#tar -zxvf pcre-8.44.tar.gz
进入安装包目录:
#cd pcre-8.44
编译安装:
#./configure
#make
#make install
查看pcre版本
#pcre-config --version)

Nginx安装前准备:

对于nginx编译安装需要先安装编译 的工具,然后再安装nginx依赖

yum -y install gcc gcc-c++ autoconf automake make
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

Nginx安装

编译:(upstream模块,默认自带:)
如下4个参数分别表示:指定用户,指定用户组,指定安装路径,指定pcre解压后的目录
#./configure --user=portal --group=aiip --prefix=/data/potal/nginx --with-pcre=/data/portal/pcre-8.44
#make
#make install

安装后操作参考(如下路径修改成实际路径)

#启动 nginx服务
/portal/nginx/sbin/nginx
#停止服务
/portal/nginx/sbin/nginx -s stop
#重启服务
/portal/nginx/sbin/nginx -s reload
#查看启动情况
ps -ef|grep nginx
#查看是否启动成功
curl 192.168.1.1
#查看端口情况
netstat -ano|grep 8080
#查看nginx版本
./portal/nginx -V.

Nginx安装报错1

./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.
nginx安装及安装问题记录
原因:缺pcre包
解决办法:安装pcre即可

Nginx安装报错2

Make的时候报错:
nginx安装及安装问题记录
原因:
nginx顺带编译了pcre,不需要单独编译
解决办法:
pcre重新指定下,指定成没编译的

相关文章: