yum -y install pcre-devel pcre gcc gcc-c++ openssl openssl-devel zlib-devel libxml2 libxml2-dev libxslt-devel gd-devel GeoIP GeoIP-devel GeoIP-data 1 cd /opt/nginx gzip模塊需要 zlib 庫 http://www.zlib.net/fossils/ wget https://zlib.net/zlib-1.2.11.tar.gz tar zxvf zlib-1.2.11.tar.gz cd zlib-1.2.11 ./configure make make install rewrite模塊需要 pcre 庫 https://ftp.pcre.org/pub/pcre/ wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz tar zxvf pcre-8.43.tar.gz cd pcre-8.43 ./configure make make install ssl 功能需要openssl庫 https://www.openssl.org/source/ wget https://www.openssl.org/source/openssl-1.0.2s.tar.gz tar zxvf openssl-1.0.2s.tar.gz cd openssl-1.0.2s ./config make make install wget http://nginx.org/download/nginx-1.18.0.tar.gz tar zxvf nginx-1.18.0.tar.gz cd nginx-1.18.0 ##--prefix=/opt/nginx-1.18.0 自定義編譯位置 ./configure --prefix=/opt/nginx-1.18.0 \ --with-select_module \ --with-poll_module \ --with-threads \ --with-file-aio \ --with-http_ssl_module \ --with-http_v2_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_xslt_module \ --with-http_xslt_module=dynamic \ --with-http_image_filter_module \ --with-http_image_filter_module=dynamic \ --with-http_geoip_module \ --with-http_geoip_module=dynamic \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_auth_request_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_degradation_module \ --with-http_slice_module \ --with-http_stub_status_module \ --with-stream \ --with-stream=dynamic \ --with-stream_ssl_module \ --with-stream_realip_module \ --with-stream_geoip_module \ --with-stream_geoip_module=dynamic \ --with-stream_ssl_preread_module \ --with-compat \ --with-pcre \ --with-pcre=/opt/nginx/pcre-8.43 \ --with-zlib=/opt/nginx/zlib-1.2.11 \ --with-openssl=/opt/nginx/openssl-1.0.2s make make install cd /opt tar -czvf nginx-1.18.0.tar.gz nginx-1.18.0/ cd /opt/nginx-1.18.0/sbin ./nginx -c conf/nginx.conf ./nginx -s stop ———————————————— 版權聲明:本文為CSDN博主「飛魚丶灬」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。 原文鏈接:https://blog.csdn.net/m0_37859032/article/details/111319398