我尝试在Ubuntu 22.04上配置nginx 1.25.2支持HTTP/3。我使用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 curl获得HTTP/3响应:
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/quiche http 3client工具,我得到了这个:
<!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完全关闭。顺便说一下,http 1和http 2工作没有任何问题。也许有人有类似的问题,可以帮助我,或者我错过了什么?我将非常感谢任何有用的信息。
1条答案
按热度按时间xytpbqjk1#
看来我们遇到了同样的情况。
结论:如果您使用浏览器,您的服务器将被要求具有有效的证书。
我的nginx版本
字符串
nginx.conf中的服务器部分
型
当我尝试bilibili/quiche时,我添加了param --disable_certificate_verification=true,这意味着只需跳过SSL检查,并且它一直有效。
型
我猜可能是SSL的问题吧?还记得系统中的CA链吗?
参考:希望能帮助你解决这个问题。
[1][https://github.com/bilibili/quiche/](https://github.com/bilibili/quiche/)
[2][https://bagder.github.io/HTTP3-test/](https://bagder.github.io/HTTP3-test/)的
对于[2],事实证明,并不是每个网站都能在浏览器中工作。令人惊讶的是。。但仍然有点困惑?
祝你今天过得愉快。
顺便说一句,不幸的是,我无法编译与http 3支持的 curl 。如果你能展示它是如何工作的,告诉我该死的正确的方法,我会很感激。
我的卷发版本
型
看起来我成功了,但是
型
感谢上帝!