沃梦达 / 编程技术 / 服务器 / 正文

ubuntu 14.04 环境下 apache2 安装阿里云ssl证书的实现方法

原文链接:http://www.bennyxu.com/index.php/program/2018/10/09/1067.html本文的实现方法是针对ubuntu 14.04系统环境下,apache2安装ssl证书的解决方案,至于其他的系统,其他的版本的apache需要用其他的方法去实现...

原文链接:http://www.bennyxu.com/index.php/program/2018/10/09/1067.html

本文的实现方法是针对ubuntu 14.04系统环境下,apache2安装ssl证书的解决方案,至于其他的系统,其他的版本的apache需要用其他的方法去实现,同时也是针对阿里云提供的第三方免费的ssl证书,至于证书的申请方法请自行百度,证书的有效期是1年。

1.开启ssl模块

a2enmod ssl

脚本解读:

a2 指的是apache2
en 指的是enabled
mod 指的是model

2.启动ssl站点

a2ensite default-ssl

脚本解读:

a2 > apache2
en > enabled
site > 站点

3.加入监听端口

vim /etc/apache2/ports.conf

编辑apache的端口配置,加入443端口

4.配置虚拟机

vim /etc/apache2/sites-enabled/default-ssl

 <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost
                ServerName bamvd.com
                DocumentRoot /var/www/html

加入 ServerName的字段,域名为自己申请的第三方的证书使用的域名。

 #   A self-signed (snakeoil) certificate can be created by installing
 #   the ssl-cert package. See
  #   /usr/share/doc/apache2/README.Debian.gz for more info.
                #   If both key and certificate are stored in the same file, only the
                #   SSLCertificateFile directive is needed.
                SSLCertificateFile      /etc/apache2/cert/public.pem
                SSLCertificateKeyFile /etc/apache2/cert/215058557650440.key

SSLCertificateFile 填写自己申请的pem文件的链接地址
SSLCertificateKeyFile 填写自己申请的key文件的链接地址

5.重启apache2服务器

/etc/init.d/apache2 restart

再次强调一下,本文主要是针对ubuntu 14.04 系统环境下,apapch2的配置方法,其他系统,其他版本的环境不适用。

ubuntu Apache2 如何 设置 HTTPS
阿里云(CentOS+Apache) 获取免费SSL证书并配置多个https链接

本文标题为:ubuntu 14.04 环境下 apache2 安装阿里云ssl证书的实现方法

基础教程推荐