当前位置: 首页 > article >正文

Centos7 安装 Openssl 和 Nginx

1. Openssl 回退低版本安装openssl-1.0.0h

openssl 默认安装版本:openssl version

OpenSSL 1.0.2k-fips 26 Jan 2017

所有版本的openssl

yum install gcc

tar -zxvf openssl-1.0.0h.tar.gz

./config --prefix=/usr/local/ssl

# 错误处理

wget https://www.cpan.org/src/5.0/perl-5.28.0.tar.gz #下载压缩包

tar -zxvf perl-5.28.0.tar.gz

cd perl-5.28.0

./Configure -des -Dprefix=$HOME/localperl

make

make test

make install

# 回到openssl目录:
[root@localhost openssl-1.0.0h]# make && make install

#安装完成


# 3. 将旧的openssl执行文件及目录重命令

mv -f /usr/bin/openssl /usr/bin/openssl.old

mv -f /usr/include/openssl /usr/include/openssl.old

# 4. 修改软链,指向新版本的openssl路径

ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl

ln -s /usr/local/ssl/include/openssl /usr/include/openssl

# 5. 添加so库的路径,添加完成之后,运行ldconfig ,将新增的so 文件缓存到/etc/ld.so.cache中

echo "/usr/local/ssl/lib">>/etc/ld.so.conf

ldconfig -v

# 6. 执行查看版本openssl版本

[root@localhost openssl-1.0.0h]# openssl version -a

OpenSSL 1.0.0h 12 Mar 2012

built on: Fri Sep 13 09:27:03 CST 2024

platform: linux-x86_64

# 7. 完成

2. 升级安装新版本openssl

yum install gcc
yum -y install perl-IPC-Cmd
yum install perl-Data-Dumper

tar  -zxvf openssl-3.3.1.tar.gz 
cd openssl-3.3.1/
./config   --prefix=/opt/openssl-3.3.1
make
make install

vim /etc/profile # 添加如下内容
export PATH=/opt/openssl-3.3.1/bin:$PATH
export LD_LIBRARY_PATH=/opt/openssl-3.3.1/lib:$LD_LIBRARY_PATH

#执行 
source /etc/profile

3. 密openssl安装

一、下载openssl国密版:https://www.gmssl.cn/gmssl/index.jsp

1) 下载gmssl_openssl_1.1_b7.tar.gz到/root/下

2) 解压 tar xzfm gmssl_openssl_1.1_b7.tar.gz -C /usr/local

3) 下载nginx-1.18.0.tar.gz到/root/下

4) 解压 tar xzfm nginx-1.18.0.tar.gz

5) 进入目录 cd /root/nginx-1.18.0,安装 pcre pcre-devel zlib等依赖库

命令:yum install -y pcre pcre-devel

命令:yum install -y zlib zlib-devel

4. 安装Nginx

(1)官网下载Nginx Nginx官网

(2) 解压

 tar zxvf nginx-1.24.0.tar.gz 

(3)开始编译,执行./configure

  1. 备注:nginx使用yum源安装,可能导致业务上很多需要的功能模块没有开启,还是按需自己编译比较合适。

  2. ./configure --help #查看./configure 支持哪些参数
    
    #--prefix=/usr/local/nginx --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module
    
    
    # ./configure --prefix=/usr/local/nginx --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-openssl=/opt/openssl-3.3.1/bin/openssl --with-openssl-opt='enable-tls1_3'
    
    # ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module
    
    ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --with-openssl=/usr/local/ssl
    
    
    #[ error ]./configure: error: the HTTP rewrite module requires the PCRE library.
    
    yum -y install pcre-devel
    
    #[ error ]./configure: error: the HTTP gzip module requires the zlib library.
    
    yum install -y zlib-devel
    
    make
    
    make install
    
    
    
    
    
    
    

    出现找不到目录的错误:nginx 安装目录中的 auto/lib/openssl/conf 去掉.openssl

 # 打开环境变量配置文件

vim /etc/profile

# 在文件末尾添加如下内容,指向nginx的安装目录

PATH=$PATH:/usr/local/nginx/sbin

# 重新加载使修改生效

source /etc/profile


http://www.kler.cn/news/361215.html

相关文章:

  • 告别ELK,APO提供基于ClickHouse开箱即用的高效日志方案——APO 0.6.0发布
  • ArcGIS002:软件自定义设置
  • 【设计模式-简单工厂】
  • 计算机视觉算法的演进与应用:从基础理论到前沿技术
  • GitLab 老旧版本如何升级?
  • Mycat2安装配置
  • 微分方程(Blanchard Differential Equations 4th)中文版Exercise 1.4
  • postgresql14主从同步流复制搭建
  • 跨域问题和前端攻击
  • 【开源免费】基于SpringBoot+Vue.JS母婴商城系统 (JAVA毕业设计)
  • 【Flutter】基础组件:Container
  • 逐行讲解大模型生成解码超参数源码(temperature、top-k、top-p等)
  • 【Flutter】配置:远程开发
  • 循环移位的学习
  • 【部署篇】rabbitmq-01介绍
  • FPGA 小鸟避障游戏
  • 磁编码器的工作原理和特点
  • 练习题(动态规划)
  • curl支持ssl报错:SSL certificate problem: unable to get local issuer certificate
  • 设置故障恢复机制
  • 2024 年某科技公司薪资 5k 前端开发岗位面试真题以及题解、知识点分析
  • 搭建自己的Docker(容器)镜像加速器
  • 广东工业大学《2021年+2020年810自动控制原理真题》 (完整版)
  • STM32--USART外设
  • Math类、System类、Runtime类、Object类、Objects类、BigInteger类、BigDecimal类
  • 『 Linux 』HTTPS