1.安装工具和库
# PCRE是一个Perl库,包括 perl 兼容的正则表达式库。nginx 的 http 模块使用 pcre 来解析正则表达式
# zlib库提供了很多种压缩和解压缩的方式, nginx 使用 zlib 对 http 包的内容进行 gzip
yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.目录结构
源码目录:/home/werben/pkgsrc/nginx
安装目录:/home/werben/application/nginx
3.下载解压源码
# 官网地址: https://nginx.org/en/download.html
wget -c https://nginx.org/download/nginx-1.17.5.tar.gz
4.创建用户组和用户
groupadd www
useradd -g www www
5.编译源码
./configure --user=www --group=www --prefix=/home/werben/application/nginx --with-http_v2_module --with-http_ssl_module --with-http_sub_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --with-pcre
make && make install
6.映射全局命令
ln -s /home/werbe