centOS 编译安装nginx

   2023-02-10 学习力0
核心提示:1、 下载并解压nginx  http://nginx.org/en/download.html  wget http://nginx.org/download/nginx-1.9.12.tar.gztar -zxvf nginx-1.9.12.tar.gz2、 编译./configure --prefix=/usr/local/server/nginx --with-http_ssl_module  error:checking for PCR

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

收工

 

 
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • nginx实战(1):宝塔设置反向代理 宝塔反向代理为什么访问不了
    nginx实战(1):宝塔设置反向代理 宝塔反向代
    以下操作适用于默认80端口转其他地址非80端口情况。添加网站注意:因我只是拿来当反向代理来使用,所PHP为纯静态模式。开启反向代理注:目标URL为最终目的地,发送域名为默认,如设置后无效则修改为上图中所示。修改反向代理配置文件说明: 修改反向代理的配置
    03-08
  • nginx1.18.0
    nginx1.18.0
    目录简介安装yum方式安装nginx编译方式安装systemd管理动态添加第三方模块作用提供静态内容简单的代理服务器设置FastCGI代理配置为注释内容使用nginx的命令以及工作机制nginx配置文件nginx_manual查看nginx安装的模块nginx是一个高性能的HTTP和反向代理web服
    03-08
  • Nginx 通过 certbot 为网站自动配置 SSL 证书并续期
    Nginx 通过 certbot 为网站自动配置 SSL 证书并
    1.1、http 和 https 是什么?简单来说,http 是一个传输网页内容的协议,比如你看到的 http 开头的网站 http://www.163.com ,其网页上的文字、图片、 CSS 、 JS 等文件都是通过 http 协议传输到我们的浏览器,然后被我们看到。而 https 可以理解为“ HTTP ov
    03-08
  • 使用漏洞检查器验证 NGINX 安全设置
    使用漏洞检查器验证 NGINX 安全设置
    介绍需要强大的安全设置来保护 Web 服务器免受网络攻击。我们使用漏洞诊断工具验证了 NGINX 安全设置所需的项目。相关术语回顾什么是 NGINX?摘自维基百科 免费和开源的网络服务器开发时专注于处理性能、高并发和小内存使用具有 HTTP、HTTPS、SMTP、POP3 和 I
    03-08
  • Nginx端口占用问题
    错误信息:nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)主要是端口被占用,通过如下命令,可以查看该端口被那个应用占用:sudo netstat -ntpl 然后kill -9 PID将其杀死关闭即可解决
    02-13
  • 基于Nginx的网关实现
    基于Nginx的网关实现
    Nginx介绍正向/反向代理 (1)正向代理正向代理,"它代理的是客户端,代客户端发出请求",是一个位于客户端和原始服务器(origin server)之间的服务器,为了从原始服务器取得内容,客户端向代理发送一个请求并指定目标(原始服务器),然后代理向原始服务器转交
    02-13
  • nginx实现unigui群集
    nginx实现unigui群集
    nginx实现unigui群集在笔者写此文的时候,UNIGUI1.50.x的版本已经发布,其提供的HyperServer已经支持群集。有网友还专门为此做了群集方面的测试:从上图可以看出:群集总共开了51个UNIGUI服务程式,总共有13357个客户端(sessions)连接,并且如此多的连接还操
    02-13
  • Linux使用nginx反向代理。可实现域名指向特定端
    在配置80指向域名的时候出现端口占用,使用kill -9无法杀死端口,应使用下面的命令来杀死进程killall -9 nginx(使用完本命令需要再把配置过的配置文件重新启动。命令写在了PS下面)后在root权限下的nginx的sbin下使用./nginx -t(命令重启nginx并检查是否有语
    02-13
  • 装tomcat和nginx心得
    开机启动tomcat1:在/etc/rc.d/init.d目录下生成一个文件tomcat80802:在文件里添加如下内#!/bin/bash#2345 linux运行级别#10开机启动优先级,数值越大越排在前面,最大值100#90关机优先级#chkconfig:2345 10 90#description: tomcat8080 start....start(){ec
    02-13
点击排行