Category Archives

11 Articles

nginx配置HTTP/3的注意事项

0   498 转为繁体

因为OpenResty近期更新到了支持HTTP/3的nginx,需要注意以下事项。

打开reuseport

在多worker配置下需要打开HTTP/3端口的reuseport选项,否则会导致两个UDP包被不同的worker处理,从而客户端报ERR_DRAINING错误。

多个Host在同一个端口监听的话,只需在其中的任意一个listen directive中添加reuseport。

把$http_host替换成$host

由于HTTP/3不再发送 Host 头而改用 :authority 伪头来,$http_host 变量变为空值。因此$http_host和ngx.var.http_host都需要改为$host和ngx.var.host。

添加Alt-Svc头

浏览器不会默认通过 HTTP/3 连接,但在看到 Alt-Svc 头后才开始尝试使用 HTTP/3 协议。

另外,随着http3的加入,http2从listen directive中被弃用,改为单独的http2 on/off; directive。

我将以上更改写成一个自动化脚本,用来批量更新多个nginx conf文件。

cloudflare-partner-cli: using CNAME on cloudflare

中文版本

This is a CLI program that let you set CNAME to use Cloudflare using the partner program.

Both Python2.x and Python3.x is supported. No extra library is needed.

To use Chinese menu, set environment variable LANG to use UTF-8 (for example, zh_CN.UTF-8).

Usage

  1. Apply for partner program at https://www.cloudflare.com/partners/.
  2. Clone this repository or download script.
  3. Run python ./cloudflare-partner-cli.py.
  4. Enter your host_key. You can get it here.
  5. Enter the account you use to manage domains (your personal account, not partner login account). User key is stored in .cfhost.
  6. Follow the instructions on screen.

Note

  • Value of resolve_to has to be DNS record (for example: google.com) instead of IP address.

cloudflare-partner-cli: 使用CNAME方式接入Cloudflare

0   11368 转为繁体

English Version

使用Cloudflare partner功能用CNAME方式接入cloudflare。

你可以使用Python2.x或者Python3.x。无需安装任何依赖。

如需使用中文菜单,请将环境变量的LANG设置为使用UTF-8 (比如zh_CN.UTF-8)。

使用方法

  1. 申请Cloudflare partner计划 https://www.cloudflare.com/partners/ 。
  2. clone本项目或者直接下载脚本
  3. 运行 python ./cloudflare-partner-cli.py
  4. 输入 host_key。可以从这里获得。
  5. 输入要用来管理域名的账号 (你的个人账号,不是partner账号)。账户信息保存在.cfhost文件中。
  6. 按照屏幕提示操作。

注意

  • 源站地址必须为DNS记录,如google.com,不能填写IP地址。