目录
1、安装依赖
# gcc安装,nginx源码编译需要
yum install gcc-c++
# PCRE pcre-devel 安装,nginx 的 http 模块使用 pcre 来解析正则表达式
yum install -y pcre pcre-devel
# zlib安装,nginx 使用zlib对http包的内容进行gzip
yum install -y zlib zlib-devel
# OpenSSL 安装,强大的安全套接字层密码库,nginx 不仅支持 http 协议,还支持 https(即在ssl协议上传输http)
yum install -y openssl openssl-devel
2、执行命令
nginx默认安装的时候没有加载stream模块
需要重新对源文件进行编译、安装,通过添加--with-stream参数指定安装stream模块
./configure --with-stream
make & make install
再次检查nginx.conf配置文件,确认配置无语法错误后,再次尝试启动服务。
nginx -t 检查配置文件是否正确
nginx -c 指定启动的配置文件