cd /usr/local/nginx-1.22.0/ ./configure --prefix=/usr/local/nginx
该操作会检测当前系统环境,以确保能成功安装 Nginx,执行该操作后可能会出现以下几种提示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
checking for OS + Linux 3.10.0-123.el7.x86_64 x86_64 checking for C compiler ... not found ./configure: error: C compiler cc is not found 如果出现以上错误提示信息,执行yum install gcc-c++安装gcc,
./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the modulebyusing--without-http_rewrite_module option, orinstall the PCRE libraryinto the system, orbuild the PCRE library statically from the sourcewith nginx byusing--with-pcre=<path> option. 如果出现上面提示,表示缺少PCRE库
./configure: error: the HTTP gzip module requires the zlib library. You can either disable the modulebyusing--without-http_gzip_module option, orinstall the zlib libraryinto the system, orbuild the zlib library statically from the sourcewith nginx byusing--with-zlib=<path> option. 如果出现以上提示,表示缺少zlib库
如果没有出现 ./configure: error 提示,表示当前环境可以安装 Nginx,执行 make 和 make install 编译 Nginx。
如果出现 cp: 'conf/koi-win' and '/usr/local/nginx/conf/koi-win' are the same file,可能是你把安装包解压到了 /usr/local/nginx 目录,解决办法是将该目录重命名为其他名称后再执行 make,make install.