Oracle云服务器下配置免费ssl证书(Let’s Encrypt)

Oracle云的web服务器使用的是nginx,在打开相应端口后,就可以访问网页。如果使用HTTPS,还需要安装配置ssl证书,目前免费的证书是Let’s Encrypt,三个月需要更新一次。

ubuntu下的Let’s Encrypt证书申请是通过certbot维护,现在已经非常简单,不再像原先那么繁琐。

安装certbot

#  sudo apt install certbot

初次安装证书

# certbot certonly

第一次申请的时候,会要求输入邮箱,这是为了到期邮件提醒。然后选择证书种类。

How would you like to authenticate with the ACME CA?

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

1: Spin up a temporary webserver (standalone)

2: Place files in webroot directory (webroot)

– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

Select the appropriate number [1-2] then [enter] (press ‘c’ to cancel):

因为是安装在服务器中,所以选择2

Please enter in your domain name(s) (comma and/or space separated) (Enter ‘c’

to cancel):

然后让输入域名。

Input the webroot for img.aaaa.net: (Enter ‘c’ to cancel):

输入域名所属网站所在的目录,如/var/www/html/img,其中域名必须已经配置完成而且目录已经建立,在此基础上,免费证书就申请成功了。

证书下载在 /etc/letsencrypt/live/相应域名目录下。

更新证书

Let’s Encrypt 签发的 SSL 证书有效期只有 90 天,证书到期前会受到邮件通知,可以通过certbot更新,更新前需要停止nginx运行。

# certbot renew

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>