1.安装gcc
安装gcc gcc-c++(如新环境,未安装请先安装)
yum install -y gcc gcc-c++
2.安装wget
安装wget
yum -y install wget
3安装PCRE库
进入/usr/local目录
cd /usr/local
下载PCRE库
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
解压
tar -zxvf pcre-8.33.tar.gz
进入cd pcre-8.33
cd pcre-8.33
安装配置
./configure
编译安装
make && make install
4.安装SSL库
yum install -y openssl openssl-devel
5.安装zlib库存
进入/usr/local/
cd /usr/local/
下载
http://zlib.net/zlib-1.2.12.tar.gz
解压
tar -zxvf zlib-1.2.12.tar.gz
进入zlib-1.2.11
cd zlib-1.2.11
配置
./configure
编译
make && make install
6安装nginx
进入
cd /usr/local/
下载nginx
wget http://nginx.org/download/nginx-1.22.0.tar.gz
解压
tar -zxvf nginx-1.22.0.tar.gz
进入nginx目录
cd nginx-1.22.0
### 以下两种编译方式二选一
编译(带ssl证书,推荐)
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
编译(不带ssl证书,不推荐)
./configure
编译
make && make install
启动nginx
/usr/local/nginx/sbin/nginx
查看nginx进程
ps -aux | grep 'nginx'
关闭防火墙
systemctl stop firewalld
停止nginx
/usr/local/nginx/sbin/nginx -s stop
重启nginx
/usr/local/nginx/sbin/nginx -s reopen