Press "Enter" to skip to content

godaddy的.app域名申请一年的免费SSL

.app域名是谷歌推出的自带免费SSL证书的域名, 如果你在Godaddy购买了.app域名, 那么你的域名会自动带有一年的免费SSL证书(需要在Godaddy申请), 本文简单写一下申请方法.

假设你申请到的域名是example.app

1, 生成csr
参考Godaddy帮助文档里的这篇文章

$ DOMAIN=example.app
$ openssl req -new -newkey rsa:2048 -nodes -keyout $DOMAIN.key -out $DOMAIN.csr

回车以后会问你一些信息,例如国家,城市等,在询问到Common Name (e.g. server FQDN or YOUR name)时建议填写你的域名信息,例如example.app

然后就会生成下面2个文件
example.app.csr
example.app.key

去Godaddy页面上申请SSL证书, 当然, 需要.csr文件中的内容

只需要几分钟, Godaddy会为你准备好证书, Download之. Download的时候, 由于”Server type”没有”Nginx”, 因此我选择了”Other”

2, 准备SSL证书
参考Godaddy帮助文档里的这篇文章

$ unzip example.app.zip

$ ls    #会解压出来2个文件
8a982df92de94106.crt  gd_bundle-g2-g1.crt  example.app.zip

生成example.app.crt文件

cat 8a982df92de94106.crt gd_bundle-g2-g1.crt >> example.app.crt

3, 配置nginx
把上面的example.app.key和example.app.crt加入到nginx的配置中即可, 这部分不再多说.

$ sudo vim /etc/nginx/sites-available/example.app
server {
        listen 80;
        server_name example.app www.example.app;
        return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;

    server_name example.app www.example.app;
    ssl_certificate     /etc/nginx/ssl/example.app.crt;
    ssl_certificate_key /etc/nginx/ssl/example.app.key;

    root /usr/www/example.app/;
    index index.php  index.html index.htm;

}

One Comment

  1. 鸟叔 2018-06-26

    手动部署挺复杂的,我的记忆中好像就没有成功过

Leave a Reply to 鸟叔 Cancel reply

Your email address will not be published. Required fields are marked *