免费启用https

浏览到coolshell上的一篇博客,可以免费启用https,赶紧按步骤体验了下。

总体流程比较顺利,也顺利创建了crontab任务

ubuntu@:~$ cat /etc/cron.d/certbot
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc.  Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew

但是http自动跳转到https并没有起作用,后来在网上找到了类似的问题,用下面的配置启用了http强制跳转

ServerName njujiang.tech
ServerAdmin njujiang@163.com
DocumentRoot /var/www/html/wordpress
Redirect / https://njujiang.tech/

发表评论

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

1 × 4 =