!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>服务器教程>香港VPS Centos7/8超简单安装nginx-quic

香港VPS Centos7/8超简单安装nginx-quic

nginx-quic是nginx正在开发中的支持http3的版本

目前网上大部分的文章都是基于源码编译安装的
下面介绍个可以直接yum安装的版本:
https://copr.fedorainfracloud.org/coprs/ryoh/nginx-quic/

安装

For CentOS 7 :

sudo yum install epel-release

sudo yum install centos-release-scl

sudo yum install yum-plugin-copr

sudo yum copr enable ryoh/nginx-quic

sudo yum install nginx-quic

 

For CentOS 8

sudo dnf install epel-release

sudo dnf copr enable ryoh/nginx-quic

sudo dnf install nginx-quic

 

注意:nginx 与 nginx-quic 不能共存,注意备份数据

配置:

server{}中添加

listen 443 http3 reuseport;  # UDP listener for QUIC+HTTP/3

ssl_protocols TLSv1.3; # QUIC requires TLS 1.3

add_header Alt-Svc \'$http3=\":443\"; ma=86400\'; # Advertise that QUIC is available

# 在新版本中$http3变量不存在,使用下面的替换

# add_header Alt-Svc \'h3-27=\":443\"; h3-28=\":443\"; h3-29=\":443\"; ma=86400; quic=\":443\"\';

add_header QUIC-Status $quic;

报错处理

首次启动失败

nginx: [emerg] cannot load certificate \"/etc/pki/tls/certs/localhost.crt\": BIO_new_file() ...

是因为在/etc/nginx/vhost.d/http/00-default.conf有配置本地签名
可以将其改名 00-default.conf_bak 或者在本地生成一个证书

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt

nginx: [emerg] unknown \"http3\" variable
将 server{}配置中的

add_header Alt-Svc \'$http3=\":443\"; ma=86400\'; # Advertise that QUIC is available

改成

add_header Alt-Svc \'h3-27=\":443\"; h3-28=\":443\"; h3-29=\":443\"; ma=86400; quic=\":443\"\';

并且将log_format.conf(/etc/nginx/conf.d/http)中的$http3去掉

参考文档

 

https://copr.fedorainfracloud.org/coprs/ryoh/nginx-quic/

https://serverfault.com/questions/648534/accidently-removed-localhost-crt-ssl-in-centos-6-what-can-i-do

https://zhuanlan.zhihu.com/p/159100819

 

给TA打赏
共{{data.count}}人
人已打赏
服务器教程

香港服务器mysql显示安装失败怎么办

2021-4-17 18:32:50

服务器教程

香港服务器原生IP和广播IP如何辨别

2021-4-17 18:32:52

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase