使用最新的Certbot在Ubuntu服务器上进行https免费证书申请和安装以及Chrome插件jsonView的两个问题

一、使用最新的Certbot在Ubuntu服务器上进行https免费证书申请和安装

    多年之前已使用过certbot进行证书操作: http://04007.cn/article/507.html,最近服务器进行了升级,所有的服务都使用了docker服务。但是certbot在docker下面操作遇到了问题。于是在裸机中搭建了一个nginx服务,在这个层面设置https 443服务转发给后端的docker容器,因此今天重新来操作certbot,certbot这几年也进行了功能升级了,比之前稍微复杂了一点,比如增加了snap工具,以前是没有的。好吧,开始吧。

    如果之前安装过certbot的工具之类的东西,需要先进行删除,Remove certbot-auto and any Certbot OS packages。

sudo apt-get remove certbot, sudo dnf remove certbot, or sudo yum remove certbot.

    然后到certbot官网设置需要安装证书的服务器型号和版本。https://certbot.eff.org/instructions?ws=nginx&os=ubuntubionic&tab=standard

#需要先安装其snap工具
https://snapcraft.io/docs/installing-snap-on-ubuntu
1。 Installing snap on Ubuntu
sudo apt update
sudo apt install snapd

# 测试是否安装成功
$ sudo snap install hello-world
hello-world 6.4 from Canonical✓ installed
$ hello-world
Hello World!

#Ensure that your version of snapd is up to date
snap install core; sudo snap refresh core
snap "core" is already installed, see 'snap help refresh'
snap "core" has no updates available

# 开始安装Install Certbot并添加命令快捷方式
snap install --classic certbot
ln -s /snap/bin/certbot /usr/bin/certbot

# 自动安装证书
certbot --nginx

期间遇到报错:

aving debug log to /var/log/letsencrypt/letsencrypt.log
The nginx plugin is not working; there may be problems with your existing configuration.
The error was: NoInstallationError("Could not find a usable 'nginx' binary. Ensure nginx exists, the binary is executable, and your PATH is set correctly.")

提示找不到nginx,是由于没有将nginx放到环境变量中,设置nginx软连接

ln -s /opt/nginx_system/sbin/nginx /usr/bin/nginx
ln -s /opt/nginx_system/conf/ /etc/nginx

        需要注意的是使用certbot进行证书操作的时候需要启动80端口并进行监听。我开始只启了443进行安装时会报错:

Hint: The Certificate Authority failed to verify the temporary nginx configuration changes made by Certbot. Ensure the listed domains point to this nginx server and that it is accessible from the internet.Some challenges have failed.

# 进行上述操作后再执行证书安装即操作成功。
root@iZ:/opt/nginx_system# certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): aaaaa@qq.com

Please read the Terms of Service at 21-2022.pdf. You must agree in order to 
(Y)es/(N)o: y

Would you be willing, once your first certificate is successfully issued, ...
(Y)es/(N)o: y
Account registered.

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: www.007.cn
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for www.007.cn

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/www.007.cn/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/www.007.cn/privkey.pem
This certificate expires on 2023-05-19.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for www.007.cn to /etc/nginx/nginx.conf
Congratulations! You have successfully enabled HTTPS on http://47.3.18.26

二、Chrome插件jsonView的两个问题

        publish:October 9, 2020 -Friday 。 jsonView是Chrome中的一个插件,可以让接口返回的json在浏览器里格式化、着色、美观、易读。一直在Chrome浏览器中使用jsonView插件。在使用中也发现它有两个问题:

1:会导致刷新一次请求两次.

    之前有一个问题印象特别深刻,就是碰到过进行代码调试的时候发现浏览器刷新一次服务器总执行两次,开始还一直排查服务端的代码问题,之后断定代码正常才发现是这个jsonView插件捣鬼,开启这个插件后就可能会出现向服务端请求两次(可能结果是json会导致它运行)。

2: 对返回的json中带有html实体字符的json串,jsonView会失效

    今天在开发接口的时候,在浏览器中翻页查看服务端的数据时,在某页中发现jsonview不起作用了,json内容不会被解析,还以为是服务端出了问题,因为我把页面的内容复制到bejson解析发现json不正常,在浏览器查看源代码把源代码进行bejson解析正常。后面认真一看数据库表中的html实体字符" -----双引号,在浏览器页面中呈现成了双引号,然后jsonView就不能识别了。白白浪费我精力和时间。不过也许这个问题和浏览器有关,jsonView不好解决吧。

三、海信集团公司的一些职级的内容记录保留在此

陆续减少的人数记录:2024-01-12:522人 、 2024-05-16:462人 、 2024-07-01:453人

海信集团公司职级变化前后的相关职级对应关系如下:
T13 对应 P9 P10 和 P11,
T12 对应 P12, P13, P14
T11 对应 P4-15
T10 对应 P4-16,P4-17
T9 对应 P5-18
T8 对应 P6-19

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

林戈的IT生涯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值