Apache2.4.7配置https,解决阿里云证书配置之痛
2017-01-05 00:00
603 查看
Chrome封杀80网站(http),逼迫小网开启443(https)。如果没有这个的话就会被浏览器或电脑管家认定为不安全的网站,当然可继续访问,但是当很多人投诉你的网站就会立刻想到与木马病毒相关的东西,认为这不是一个好网站。
阿里云服务器开启https还是蛮麻烦的,还好Symantec证书是免费提供1年。虽然阿里云给出了证书及教程,然没有Apache2.4.7版本的。
阿里云提供了3个证书,public.pem和21#######63.key(为SSLCertificateFile),chain.pem(为Server Certificate Chain)。
下面开始配置一下apache2
修改内容为如下
在SSLEngine on 下面找到2行 注释掉
重启apache即可使用。
参考资料:
http://blog.csdn.net/newjueqi/article/details/9789659
http://blog.csdn.net/buzaishabi/article/details/39346561
我的博客地址:https://www.nigaea.com/programmer/123.html
阿里云服务器开启https还是蛮麻烦的,还好Symantec证书是免费提供1年。虽然阿里云给出了证书及教程,然没有Apache2.4.7版本的。
阿里云提供了3个证书,public.pem和21#######63.key(为SSLCertificateFile),chain.pem(为Server Certificate Chain)。
下面开始配置一下apache2
使用复制密钥,开启ssl
mkdir /etc/apache2/ssl 创建ssl文件夹 mv /download/public.pem /etc/apache2/ssl/public.pem mv /download/21#####63.key /etc/apache2/ssl/21#####63.key mv /download/chain.pem /etc/apache2/ssl/chain.pem a2enmod ssl #启用ssl
修改ports.conf
vi /etc/apache2/ports.conf
修改内容为如下
Listen 80 <IfModule ssl_module> Listen 443 </IfModule> <IfModule mod_gnutls.c> Listen 443 </IfModule>
修改default-ssl
vi /etc/apache2/sites-available/default-ssl.conf
在SSLEngine on 下面找到2行 注释掉
# SSLCertificateFile directive is needed. SSLCertificateFile /etc/apache2/ssl/public.pem SSLCertificateKeyFile /etc/apache2/ssl/21#####63.key # Server Certificate Chain: # Point SSLCertificateChainFile at a file containing the # concatenation of PEM encoded CA certificates which form the # certificate chain for the server certificate. Alternatively # the referenced file can be the same as SSLCertificateFile # when the CA certificates are directly appended to the server # certificate for convinience. SSLCertificateChainFile /etc/apache2/ssl/chain.pem
启用ssl,重启apache
a2ensite default-ssl /etc/init.d/apache2 restart
htaccess将HTTP访问重定向至HTTPS
RewriteEngine on RewriteBase / RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
重启apache即可使用。
参考资料:
http://blog.csdn.net/newjueqi/article/details/9789659
http://blog.csdn.net/buzaishabi/article/details/39346561
我的博客地址:https://www.nigaea.com/programmer/123.html
相关文章推荐
- Apache2.4.7配置https,解决阿里云证书配置之痛
- window2008下基于阿里云免费HTTPS证书+apache2.4.27的HTTPS配置方法
- 关于apache配置阿里云证书https的步骤(详细)
- 阿里云https证书Apache配置
- window2008下基于阿里云免费HTTPS证书+apache2.4.27的HTTPS配置方法
- 如何解决实际错误:配置IIS使其支持SSL加密的HTTPS,并且要求浏览器客户端证书
- Centos6.3下Apache配置基于加密的认证https加密证书访问
- 解决阿里云SLB无法添加https证书的问题
- 用tomcat配置https自签名证书,解决 ios7.1以上系统, 苹果inHouse发布
- Apache2.4.7配置https
- 为微信小程序搭建https服务,证书申请及配置。Apache服务器。重点描述request:fail ssl hand shake error 错误
- openssl命令生成公私钥、证书方法,apache/tomcat支持https的证书配置
- 如何解决实际错误:配置IIS使其支持SSL加密的HTTPS,并且要求浏览器客户端证书
- 阿里云服务器配置HTTPS证书记录
- 解决 SharePoint Server 2013 的工作流安装和配置--部署失败 HTTPS 遇到证书错误
- 阿里云SLB HTTPS证书配置
- Windows下Apache配置SSL以支持https及出错的解决办法
- 用tomcat配置https自签名证书,解决 ios7.1以上系统, 苹果inHouse发布
- apache服务器安装配置ssl数字证书,https访问
- 阿里云申请的免费证书,配置到Tomcat,实现https访问