在linux apache服务器上,给内网ip配置https

1)安装OpenSSL

yum install mod_ssl openssl

2)生成2048位的加密秘钥

openssl genrsa -out ca.key 2048

3)生成服务器公钥(CSR)

openssl req -new -key ca.key -out ca.csr

4)生成类型为X509的自签名证书

openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt

5)在/etc/httpd/conf.d会目录下生成ssl.conf配置文件,编辑

#监听443端口

Listen 443

<VirtualHost _default_:443>

#基础配置

#说明此虚拟站点使用HTTPS通信

SSLEngine on

#假设证书相关文件存放路径为/opt/apache

SSLCertificateFile /opt/apache/ca.crt

SSLCertificateKeyFile /opt/apache/ca.key   

SSLCertificateChainFile /opt/apache/ca.crt

</VirtualHost>

6、重启apache生效

systemctl restart httpd

原文地址:https://www.cnblogs.com/hualingyun/p/14539394.html