##查看内核版本
[yym@localhost code]$ uname -a
Linux localhost.localdomain 5.4.263-1.el7.elrepo.x86_64 #1 SMP Fri Dec 8 19:44:51 EST 2023 x86_64 x86_64 x86_64 GNU/Linux
[yym@localhost code]$ cat /proc/version
Linux version 5.4.263-1.el7.elrepo.x86_64 (root@68e0b5963fa3433dacf297ada3c1b494) (gcc version 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)) #1 SMP Fri Dec 8 19:44:51 EST 2023
##获取nginx源码
##配置
[yym@localhost code]$ cd /home/yym/code/nginx-1.22.1
[yym@localhost code]$ ./configure --prefix=/home/yym/code/nginx_debug/ --with-http_addition_module --with-http_realip_module --with-http_stub_status_module --with-ipv6 --with-cc-opt='-O0 -g'
##报错
./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
[yym@localhost code]$ ##yum install pcre.x86_64 ##阿里云yum源 还是失败
##使用原始yum源
##安装pcre pcre-devel
[yym@localhost code]$ yum install pcre pcre-devel
##报错
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib= option
##安装zlib-devel
[yym@localhost code]$ yum install -y zlib-devel
##编译
[yym@localhost code]$ make CFLAGS="-g -oO"
##安装
[yym@localhost code]$ make install