![Nginx 1.25.2 HTTP/3 可通过 CURL 运行,但无法在任何浏览器中运行](https://linux22.com/image/788710/Nginx%201.25.2%20HTTP%2F3%20%E5%8F%AF%E9%80%9A%E8%BF%87%20CURL%20%E8%BF%90%E8%A1%8C%EF%BC%8C%E4%BD%86%E6%97%A0%E6%B3%95%E5%9C%A8%E4%BB%BB%E4%BD%95%E6%B5%8F%E8%A7%88%E5%99%A8%E4%B8%AD%E8%BF%90%E8%A1%8C.png)
我正在尝试配置nginx 1.25.2和HTTP/3支持Ubuntu 22.04.我使用BoringSSL库。但是当我尝试使用浏览器连接到我的服务器时,我什么也没得到。(例如,Firefox 中显示“无法连接”,Chrome 中显示“无法访问此站点”)。
这是nginx -V输出:
built with OpenSSL 1.1.1 (compatible; BoringSSL) (running with BoringSSL)
TLS SNI support enabled configure arguments:
--prefix=/etc/nginx --with-http_ssl_module --with-http_v2_module --with-debug
--with-http_v3_module --with-cc-opt=-I../boringssl/include
--with-ld-opt='-L../boringssl/build/ssl -L../boringssl/build/crypto'
这是我的服务器部分nginx.conf:
server {
#listen 443 ssl
#http2 on;
listen 443 quic reuseport;
server_name example_myserver;
ssl_certificate cert.pem;
ssl_certificate_key key.pem;
ssl_protocols TLSv1.3;
location / {
add_header Alt-Svc 'h3=":443"; ma=86400';
root html;
index index.html index.htm;
}
使用上述配置我可以使用获取 HTTP/3 响应http3 curl:
HTTP/3 200
server: nginx/1.25.2
date: Wed, 23 Aug 2023 08:12:55 GMT
content-type: text/html
content-length: 615
last-modified: Tue, 22 Aug 2023 14:25:41 GMT
etag: "64e4c565-267"
alt-svc: h3=":443"; ma=86400
accept-ranges: bytes
并使用https://github.com/cloudflare/quichehttp3client 工具我得到这个:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
但是当我通过浏览器访问同一台服务器时,什么都没有(Firefox 中显示“无法连接”,Chrome 中显示“无法访问此站点”)。UFW 已关闭离开完全。顺便说一下,http1和http2没有任何问题。也许有人遇到过类似的问题,可以帮助我,或者我可能错过了什么?我会很感激任何有用的信息。