centOS 编译安装nginx
1、 下载并解压nginx
http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.9.12.tar.gz tar -zxvf nginx-1.9.12.tar.gz
2、 编译
./configure --prefix=/usr/local/server/nginx --with-http_ssl_module
error:
checking for PCRE library ... not found checking for PCRE library in /usr/local/ ... not found checking for PCRE library in /usr/include/pcre/ ... not found checking for PCRE library in /usr/pkg/ ... not found checking for PCRE library in /opt/local/ ... not found ./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=<path> option.
安装pcre以解决问题
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.tar.bz2 tar -xvf pcre-8.38.tar.bz2 cd pcre-8.38/ ./configure --prefix=/usr/local/src/pcre-8.38 make && make install
重新编译nginx
./configure --prefix=/usr/local/server/nginx --with-pcre=/data/software/pcre-8.38--with-http_ssl_module
error
checking for md5 in system md library ... not found checking for md5 in system md5 library ... not found checking for md5 in system OpenSSL crypto library ... not found checking for sha1 in system md library ... not found checking for sha1 in system OpenSSL crypto library ... not found checking for zlib library ... not found ./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=<path> option.
安装zlib以解决问题
wget http://zlib.net/zlib-1.2.8.tar.gz tar -zxvf zlib-1.2.8.tar.gz ./configure --prefix=/usr/local/src/zlib-1.2.8 make && make install
重新编译nginx
./configure --prefix=/usr/local/server/nginx --with-pcre=/data/software/pcre-8.38 --with-zlib=/data/software/zlib-1.2.8 --with-http_ssl_module
error (汗...)
checking for getaddrinfo() ... found checking for OpenSSL library ... not found checking for OpenSSL library in /usr/local/ ... not found checking for OpenSSL library in /usr/pkg/ ... not found checking for OpenSSL library in /opt/local/ ... not found ./configure: error: SSL modules require the OpenSSL library. You can either do not enable the modules, or install the OpenSSL library into the system, or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option.
惯性作用下要安装OpenSSL以解决问题 ,然而发现openssl已经安装
which openssl /usr/bin/openssl
最后一次编译安装nginx...
./configure --prefix=/usr/local/server/nginx --with-pcre=/data/software/pcre-8.38 --with-zlib=/data/software/zlib-1.2.8 --with-http_ssl_module
--with-openssl=/usr/bin/openssl
然而
make && make install cd /usr/bin/openssl \ && if [ -f Makefile ]; then make clean; fi \ && ./config --prefix=/usr/bin/openssl/.openssl no-shared \ && make \ && make install_sw LIBDIR=lib /bin/sh: 第 0 行:cd: /usr/bin/openssl: 不是目录 make[1]: *** [/usr/bin/openssl/.openssl/include/openssl/ssl.h] 错误 1
好吧,再安装一次(用这样的方法感觉自己要笨死了,但我真的找不到openssl的源码目录)
安装openssl
wget https://www.openssl.org/source/openssl-1.0.2g.tar.gz tar -zxvf openssl-1.0.2g.tar.gz cd openssl-1.0.2g/ ./config --prefix=/usr/local/src/openssl make && make install
编译安装 nginx
./configure --prefix=/usr/local/server/nginx --with-pcre=/data/software/pcre-8.38 --with-zlib=/data/software/zlib-1.2.8 --with-http_ssl_module --with-openssl=/usr/bin/openssl
make && make instal
cp /usr/local/server/nginx/sbin/nginx /usr/local/sbin
收工
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
· 对象命名为何需要避免'-er'和'-or'后缀
· SQL Server如何跟踪自动统计信息更新?
· AI与.NET技术实操系列:使用Catalyst进行自然语言处理
· 官方的 MCP C# SDK:csharp-sdk
· 一款 .NET 开源、功能强大的远程连接管理工具,支持 RDP、VNC、SSH 等多种主流协议!
· 提示词工程师自白:我如何用一个技巧解放自己的生产力
· 一文搞懂MCP协议与Function Call的区别
· 如何不购买域名在云服务器上搭建HTTPS服务