Nginx之後續過程模組的新增
阿新 • • 發佈:2020-10-09
首先檢視一下當初安裝nginx時新增的模組
[root@client1 nginx-1.15.9]# nginx -V nginx version: nginx/1.15.9 built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx
然後切換到當初nginx安裝包的解壓路徑,編譯時注意重新修改所需模組,最後執行make即可,無需執行make install
[root@client1 nginx-1.15.9]# cd /usr/src/nginx-1.15.9/ [root@client1 nginx-1.15.9]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module && make
如果安裝過程中有報錯的話,可能是缺少必要依賴包。可以安裝模組所需的依賴包進行解決下,常見的依賴安裝包有
pcre-devel zlib-devel openssl-devel
將原先的nginx命令備份一下
[root@client1 nginx-1.15.9]# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
然後將解壓包中的命令copy一份過去,注意需要關閉nginx程序,否則會報錯“文字檔案忙”;
[root@client1 nginx-1.15.9]# cp /usr/src/nginx-1.15.9/objs/nginx /usr/local/nginx/sbin/nginx
然後檢視所支援nginx模組
[root@client1 nginx-1.15.9]# nginx -V nginx version: nginx/1.15.9 built by gcc 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module