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   11371 轉為簡體

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地址。