系统相关
首页 > 系统相关> > centos7 安装 nginx

centos7 安装 nginx

作者:互联网

1.安装反编译工具

$ yum -y install make zlib zlib-devel gcc gcc-c++ libtool  openssl openssl-devel pcre pcre-devel  //PCRE 作用是让 Nginx 支持 Rewrite 功能

2.验证是否成功

$ gcc --version

输出如下则为成功
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

3. 安装pcre

#wget 获取安装包
wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz

#解压
tar zxvf ./pcre-8.35.tar.gz 

#进入解压目录
cd ./pcre-8.35/

#执行 configure文件
./configure 

#编译 && 编译安装
make && make install

#验证版本
pcre-config --version

4、下载安装编译nginx

多台机器情况下,注意版本一致

#下载
wget http://nginx.org/download/nginx-1.4.7.tar.gz

#解压
tar zxvf ./nginx-1.4.7.tar.gz 

#进入目录
cd ./nginx-1.4.7/

#带参数编译
./configure --prefix=/home/work/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/home/work/pcre-8.35

#编译
make

#编译安装
make install

执行完成上面所有操作之后,会出现/home/work/nginx文件夹(无版本号)

#验证版本号
/home/work/nginx/sbin/nginx -v

5、启动nginx

#验证配置文件
/home/work/nginx/sbin/nginx -t

#启动
/home/work/nginx/sbin/nginx

# -> 重启
/home/work/nginx/sbin/nginx -s reload

标签:pcre,tar,work,centos7,nginx,8.35,home,安装
来源: https://blog.csdn.net/qq_31573519/article/details/88897204