1.项目上线,以前没有配置过https的安全连接。。。刚刚申请了一个https免费证书。(我使用的是unbantu16系统)
Let’s Encrypt 是属于介绍性质的,而真正用到的工具是 Certbot,去 https://certbot.eff.org/ 下载合适自己系统的Certbot。
2. 下载Certbot
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
3.配置 nginx
location ^~ /.well-known/ {
alias /var/www/html;
default_type "text/plain";
allow all;
}
4.https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx(原网连接)。
5.cd /etc/nginx/sites-available/default进行配置:(如下)
server {
# 访问http 跳转到https
listen 80;
server_name example.com;
rewrite ^(.*) https://$server_name$1 per