Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

CentOS 編譯安裝 Nginx 缺少 PCRE 與 OpenSSL 開發庫的解決方法

編輯:關於伺服器

錯誤現象

./configure: error: the HTTP rewrite module requires the PCRE library.
./configure: error: the HTTP cache module requires md5 functions from OpenSSL library.

解決:安裝開發套件

yum -y install pcre-devel openssl openssl-devel

完整編譯安裝流程

wget https://nginx.org/download/nginx-1.24.0.tar.gz  # 建議使用新版
tar -zxvf nginx-1.24.0.tar.gz
cd nginx-1.24.0
./configure --prefix=/usr/local/nginx
make
make install

常用模組說明

  • pcre-devel:支援 rewrite、正則匹配。
  • openssl-devel:支援 ssl、cache、md5 等加密功能。
  • 若需 HTTP/2:yum -y install nghttp2-devel 並加入 --with-http_v2_module。

驗證

/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx
curl -I https://localhost
Copyright © Windows教程網 All Rights Reserved