1 # DNS-over-HTTPS Server {#module-service-doh-server}
3 [DNS-over-HTTPS](https://github.com/m13253/dns-over-https) is a high performance DNS over HTTPS client & server. This module enables its server part (`doh-server`).
5 ## Quick Start {#module-service-doh-server-quick-start}
7 Setup with Nginx + ACME (recommended):
11 services.doh-server = {
14 upstream = [ "udp:1.1.1.1:53" ];
20 virtualHosts."doh.example.com" = {
24 locations."/".return = 404;
25 locations."/dns-query" = {
26 proxyPass = "http://127.0.0.1:8053/dns-query";
27 recommendedProxySettings = true;
30 # and other virtual hosts ...
35 defaults.email = "you@example.com";
38 networking.firewall.allowedTCPPorts = [ 80 443 ];
42 `doh-server` can also work as a standalone HTTPS web server (with SSL cert and key specified), but this is not recommended as `doh-server` does not do OCSP Stabbing.
44 Setup a standalone instance with ACME:
48 domain = "doh.example.com";
51 security.acme.certs.${domain} = {
52 dnsProvider = "cloudflare";
53 credentialFiles."CF_DNS_API_TOKEN_FILE" = "/run/secrets/cf-api-token";
56 services.doh-server = {
60 upstream = [ "udp:1.1.1.1:53" ];
65 networking.firewall.allowedTCPPorts = [ 443 ];
69 See a full configuration in https://github.com/m13253/dns-over-https/blob/master/doh-server/doh-server.conf.