『贴代码』
PasteSpider
PasteApeart
精选作品
优选问答
成长笔记
【本期话题】更多
                                    我们在开发中经常遇到对方的接口请求有频率限制,比如当前接口每秒的请求不能大于100,不能大于1000,对于这样的,我们作为请求方,如何做限定?
                    
免费SSL证书,自动续期配置,配合PasteSpider的路由策略,用得飞起
尘埃 2023-02-05 4752 252 0 编辑
在centos7中配置免费的SSL,可以自动续期

https://letsencrypt.org/

很火得一个免费证书获取渠道,接下来我们看下如何在linux上配置,让ssl证书自动续期

我们使用 https://certbot.eff.org/ 模式

比如我使用centos7,运行在Nginx上,如下选择

image.png

如果你是其他系统得,反正就是按照这个提示去选择,他会有教程告诉你接下来如何操作!

比如我上面选择的环境

SSH into the server

使用SSH连接到服务器

SSH into the server running your HTTP website as a user with sudo privileges.

以具有sudo权限的用户身份将SSH连接到运行HTTP网站的服务器,或者root账号也行

Install snapd

安装snapd

You'll need to install snapd and make sure you follow any instructions to enable classic snap support.

您需要安装snapd,并确保按照任何说明启用经典的snap支持。

Follow these instructions on snapcraft's site to install snapd.

按照snapcraft网站上的说明安装snapd。

如何检测当前服务器是否安装了snapd?直接输入命令

snap --version

看看提示啥,如果提示 snap command not found!那就是没有安装,需要参照一下教程安装

打开snap安装的官网

https://snapcraft.io/docs/installing-snapd

在中间位置表格处找到Centos,然后往下拉,可以看到如下提示

image.png

Ensure that your version of snapd is up to date

确保snapd的版本是最新的

Execute the following instructions on the command line on the machine to ensure that you have the latest version of snapd.

在计算机的命令行上执行以下指令,以确保您拥有最新版本的snapd。

sudo snap install core; sudo snap refresh core

Remove certbot-auto and any Certbot OS packages

删除certbot auto和任何certbot OS包

If you have any Certbot packages installed using an OS package manager like apt, dnf, or yum, you should remove them before installing the Certbot snap to ensure that when you run the command certbot the snap is used rather than the installation from your OS package manager. The exact command to do this depends on your OS, but common examples are sudo apt-get remove certbot, sudo dnf remove certbot, or sudo yum remove certbot.

如果使用apt、dnf或yum等操作系统软件包管理器安装了任何Certbot软件包,则应在安装Certbot snap之前将其删除,以确保在运行命令Certbot时使用snap,而不是从操作系统软件管理器安装。执行此操作的确切命令取决于您的操作系统,但常见的示例有sudo apt-get remove certbot、sudo dnf remove certbot或sudo yum remove certbot。

Install Certbot

安装Certbot

Run this command on the command line on the machine to install Certbot

在计算机上的命令行上运行此命令以安装Certbot

sudo snap install --classic certbot

Prepare the Certbot command

准备Certbot命令

Execute the following instruction on the command line on the machine to ensure that the certbot command can be run.

在计算机的命令行上执行以下指令,以确保可以运行certbot命令。

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Choose how you'd like to run Certbot

选择运行Certbot的方式

Either get and install your certificates...

获取并安装证书。。。

Run this command to get a certificate and have Certbot edit your nginx configuration automatically to serve it, turning on HTTPS access in a single step.

运行此命令以获取证书,并让Certbot自动编辑nginx配置以提供证书,只需一步即可打开HTTPS访问。

sudo certbot --nginx

Or, just get a certificate

或者,只要拿到证书

If you're feeling more conservative and would like to make the changes to your nginx configuration by hand, run this command.

如果您感觉更保守,并且希望手动更改nginx配置,请运行此命令。

sudo certbot certonly --nginx

Test automatic renewal

测试自动续订

The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running this command:

系统上的Certbot软件包附带一个cron作业或systemd计时器,该计时器将在证书过期之前自动续订您的证书。除非更改配置,否则不需要再次运行Certbot。您可以通过运行以下命令测试证书的自动续订:

sudo certbot renew --dry-run

The command to renew certbot is installed in one of the following locations:

续订certbot的命令安装在以下位置之一:

  • /etc/crontab/
  • /etc/cron.*/*
  • systemctl list-timers

Confirm that Certbot worked

确认Certbot工作正常

To confirm that your site is set up properly, visit https://yourwebsite.com/ in your browser and look for the lock icon in the URL bar.

要确认您的网站设置正确,请访问https://yourwebsite.com/在浏览器中,并在URL栏中查找锁定图标。


我们有计划在后续的PasteSpider版本中引入一键安装这个ssl证书!



评论列表
尘埃
252 4752 0
快捷注册
用户问答更多
PasteApeart和PasteForm如何选择?
  • 不用选,后面都是PasteApeart,他们其实是一个东西

PasteApeart中有多层级继承的,表单中的字段排列顺序有什么规则?
  • 看版本,PasteApeart.Helper 26.9.2之后,就按照基类前面的顺序了,也符合阅读顺序,当然你可以使用PasteSort再次改变他!

PasteForm,神奇了啊!都说低代码,低代码,那个是对于非开发者来说的,感觉PasteForm就是开发者的低代码啊!只要配置好Model,就有对应的CRUD操作,还带一些逻辑,和生成代码是两码事了!!!问题来了,有什么局限性,或者适用哪些场景?
  • 1.语言吧,这本身只是一个开发思想,其实其他语言也可以用,不过最优雅实现的还是.NET

    2.特别适用于需要表单,表格的系统,所以哪些EMS,CRM,ERP等都合适

    3.扩展,比如这个思想,你也可以应用于C/S,理论上也是可以的

    4.这个主要针对的是管理端,附带UI的CRUD,也就是说对于业务代码,是没影响的!

    5.可能入门会麻烦点,毕竟有接近100个PasteXXXX特性要了解,幸运的是都是Paste开头,官方的也支持,比如MaxLength,Required等!

最新动态
  • 216.****.137 正在查看 PasteSpider中关于Nginx的配置,安装PasteSpider之后查阅 !
  • 216.****.137 正在查看 文章列表页 !
  • 216.****.137 正在查看 我配置了一个枚举类型,提交的时候是2,咋查询出来的时候还是0 !
  • 216.****.137 正在查看 环境的选择能否用直接模式,不要每次都弹出页面选择 !
  • 114.****.237 正在查看 【PasteApeart】最佳CRUD的实现案例项目PasteTemplate解析,包含源码(一) !
  • 216.****.137 正在查看 Serilog的全局处理,发生异常后,如何统一处理?只要引入一个ILogEventSink即可,一起瞧瞧去 !
  • 216.****.137 正在查看 12306班次筛选座位逻辑 !
  • 216.****.137 正在查看 别在无脑的统一封装返回了,会暴露你的实力的,不信一起来看看 !
  • 216.****.137 正在查看 关于PasteSpider的权限模块变更前的思考,另类的鉴权模式,很有参考意义 !
  • 216.****.137 正在查看 使用Obfuscar混淆(加密)你的程序源码并一键发布! !
  • 216.****.137 正在查看 有哪些高大上的词语,你有没有被虎得一愣一愣得,一起来看看AI的吐槽! !
欢迎加入QQ讨论群 296245685 [PasteSpider]介绍 [PasteForm]介绍 @2022-2023 PasteCode.cn 版权所有 ICP证 闽ICP备2021013869号-2