ubantu16.04安装nginx,并使用certbot做https

参考文档:

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04

  • 首先,添加存储库。

sudo add-apt-repository ppa:certbot/certbot

  • 你需要按下ENTER接受。然后,更新包列表以获取新存储库的包信息。

sudo apt-get update

  • 最后,安装Certbot的Nginx软件包apt-get。

sudo apt-get install python-certbot-nginx

  • 配置好nginx的server_name 指向需要的地址。
server {
        listen       80;
        server_name  xx.xxx.com;
        location / {
                add_header Access-Control-Allow-Origin *;
                proxy_pass http://localhost:8080;
        }

}
  • 设置SSL

sudo certbot --nginx -d xx.xxx.com

猜你喜欢

转载自my.oschina.net/u/2601303/blog/2988522