用户工具

站点工具


xnix:nginx_doh

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
xnix:nginx_doh [2021/08/18 10:18] – ↷ 页面freebsd:network:nginx_doh被移动至xnix:nginx_doh Hshhxnix:nginx_doh [2021/12/30 04:47] (当前版本) Hshh
行 4: 行 4:
  
   - [[https://www.nginx.com/blog/using-nginx-as-dot-doh-gateway/|Using NGINX as a DoT or DoH Gateway]]   - [[https://www.nginx.com/blog/using-nginx-as-dot-doh-gateway/|Using NGINX as a DoT or DoH Gateway]]
-  - [[https://github.com/TuxInvader/nginx-dns|NGINX DNS (DNS/DoT/DoH)]]+  - [[https://github.com/TuxInvader/nginx-dns|NGINX DNS (DNS/DoT/DoH), nginx_stream.js源代码]]
   - [[https://www.nginx.com/blog/introduction-nginscript|Introduction to the NGINX JavaScript Module]]   - [[https://www.nginx.com/blog/introduction-nginscript|Introduction to the NGINX JavaScript Module]]
   - [[https://nginx.org/en/docs/njs/|njs scripting language]]   - [[https://nginx.org/en/docs/njs/|njs scripting language]]
行 22: 行 22:
 <code>--add-module=/path/njs-src/nginx</code> <code>--add-module=/path/njs-src/nginx</code>
  
 +njs 的 [[http://hg.nginx.org/njs|最新源代码]]
 ==== 配置 Nginx ==== ==== 配置 Nginx ====
  
行 71: 行 72:
  ssl_dhparam /path/dh4096.pem;  ssl_dhparam /path/dh4096.pem;
  tcp_nodelay on;  tcp_nodelay on;
- js_include /path/nginx_dns/nginx_stream.js;+ js_import /path/nginx_dns/nginx_stream.js;
  upstream dot {  upstream dot {
  zone dot 64k;  zone dot 64k;
行 79: 行 80:
  server {  server {
  listen 127.0.0.1:8053;  listen 127.0.0.1:8053;
- js_filter dns_filter_doh_request;+ js_filter nginx_stream.dns_filter_doh_request;
  proxy_ssl on; # 如果上面upstream dot内的DNS服务器不是DoT, 即是普通53端口, 则注释本行  proxy_ssl on; # 如果上面upstream dot内的DNS服务器不是DoT, 即是普通53端口, 则注释本行
  proxy_pass dot;  proxy_pass dot;
  }  }
 } }
 +</code>
 +
 +==== nginx_stream.js hack ====
 +在本次修改前, nginx_stream.js 还未适配最新的 njs, 需要手动添加以下至文件末尾
 +<code>
 +export default { glb_get_response, glb_process_request, glb_get_edns_subnet, dns_filter_doh_request, dns_preread_doh_request, dns_preread_dns_request, dns_get_qname, dns_get_response };
 </code> </code>
  
行 95: 行 102:
 === 使用 doh === === 使用 doh ===
 参见 https://github.com/curl/doh 参见 https://github.com/curl/doh
 +
 +==== 更新说明 ====
 +  * 20211228, 新版的 njs, 需要 js 源代码输出 export, 为此 js_filter 也需要声明命名空间. 另外配置文件中的 js_include 已被废弃, 取而代之为 js_import. nginx_stream.js 也可能需要手动修改适配.
xnix/nginx_doh.1629253084.txt.gz · 最后更改: 2021/08/18 10:18 由 Hshh