Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4142555
  • 博文数量: 447
  • 博客积分: 1241
  • 博客等级: 中尉
  • 技术积分: 5786
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-27 06:48
个人简介

读好书,交益友

文章分类

全部博文(447)

文章存档

2023年(6)

2022年(29)

2021年(49)

2020年(16)

2019年(15)

2018年(23)

2017年(67)

2016年(42)

2015年(51)

2014年(57)

2013年(52)

2012年(35)

2011年(5)

分类: 网络与安全

2021-11-06 18:20:53

1 下载代码

点击(此处)折叠或打开

  1. git clone https://github.com/guanzhi/GmSSL.git
2 cd GmSSL
./config no-shared
make 
sudo make install

3 从国密pfx的证书中分离出公钥
openssl pkcs12 -in operator.p12 -clcerts -nokeys -out operator.pem

4 下载nginx 

点击(此处)折叠或打开

  1. http://nginx.org/download/nginx-1.20.1.tar.gz
5 安装第三方软件包
sudo apt-get install libpcre3 libpcre3-dev
sudo apt-get install zlib1g-dev 

6 编译nginx 使用静态链接gmssl
 ./configure --with-http_ssl_module  --with-openssl="/software/GmSSL"  --with-cc-opt="-I/software/GmSSL/include"
make
make install
此时的安装目录是/usr/local
7 在 

点击(此处)折叠或打开

  1. https://gmssl.cn/gmssl/index.jsp

申请sm2证书
编辑nginx的配置文件 添加如下的配置
server
{
  listen 0.0.0.0:443 ssl;
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:AES128-SHA:DES-CBC3-SHA:ECC-SM4-CBC-SM3:ECDHE-SM4-GCM-SM3;
  ssl_verify_client off;


  ssl_certificate /usr/local/nginx/conf/key/sm2.tianjian.sig.crt.pem;
  ssl_certificate_key /usr/local/nginx/conf/key/sm2.tianjian.sig.key.pem;


  ssl_certificate_key /usr/local/nginx/conf/key/sm2.tianjian.enc.key.pem;
  ssl_certificate /usr/local/nginx/conf/key/sm2.tianjian.enc.crt.pem;


  location /
  {
    root html;
    index index.html index.htm;
  }
}
阅读(1597) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~