Apache2.4.37配置ssl证书

资源贴

为什么https链接通过客户端软件抓包后还是明文:https://blog.csdn.net/stpeace/article/details/78073288

为什么https链接会显示不安全:https://blog.csdn.net/coding_zhu/article/details/70262677

 

1、ssl证书:可以申请腾讯的免费证书 https://buy.cloud.tencent.com/ssl?fromSource=ssl

参考文档:https://cloud.tencent.com/document/product/400/4143#1.-apache-2.x-.E8.AF.81.E4.B9.A6.E9.83.A8.E7.BD.B2

下载以后有以下文件

2、配置 http.conf末尾新增

<VirtualHost *:443> #https默认监听443端口
	ServerAdmin #管理员联系方式#
	DocumentRoot #项目目录#
        ServerName https://127.0.0.1
	ServerAlias #服务器别名#
    SSLEngine on
    #申请证书#
    SSLCertificateFile "/usr/local/install/apache/ssl/2_www.jiayuangzs.cn.crt"
    SSLCertificateKeyFile "/usr/local/install/apache/ssl/3_www.jiayuangzs.cn.key"
    SSLCertificateChainFile "/usr/local/install/apache/ssl/1_root_bundle.crt"
    #日志文件#
    ErrorLog "logs/https-error.log"
    CustomLog "logs/https-access.log" common    
    #开启ssl
    SSLProxyEngine on
    <Directory "/usr/local/service">
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    
    #反向代理设置 /表明127.0.0.1:443的所有文件都会被重定向到https://127.0.0.1:8081/
    ProxyPass /test http://127.0.0.1:8081/test
    ProxyPassReverse /testhttp://127.0.0.1:8081/test
</VirtualHost>

放开注释:
 

#LoadModule proxy_module modules/mod_proxy.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
#LoadModule ssl_module modules/mod_ssl.so

3、安装时需要开启ssl支持,否者会没有响应模块

./configure --prefix=/usr/local/install/apache/httpd-2.4.37 --with-apr=/usr/local/install/apache/apr-1.6.5 --with-apr-util=/usr/local/install/apache/apr-util-1.6.1 --with-pcre=/usr/local/install/apache/pcre-8.42 --enable-ssl  

安装时如果包opensll version too old 可以更新openssl版本

yum install openssl-devel
yum update openssl

4、效果:

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值