Nginx-クイックエクスペリエンス-夢の建物への道

nginx-quicをコンパイルしてインストールします

オペレーティングシステム:centos 7 minal x86_64

nginx-quic:https://quic.nginx.org/readme.html公式インストールドキュメント


一般的なツールをインストールします:
yum install -y lrzsz wget curl unzip vim hg git gcc-c ++ make automake openssl-devel

#CentOSインストールlibunwind拡張ライブラリ
yum install libunwind-devel -y

#インストールgo
wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
tar -C / usr / local -xzf go1.15.2.linux-amd64.tar.gz
#セットアップシステム環境変数は、プロファイルに書き込むこともできます。exportPATH
= $ PATH:/ usr / local / go / bin
export PATH = $ PATH:$ HOME / .cargo / bin
export GOROOT = / usr / local / go
export GOBIN = $ GOROOT / bin
export PATH = $ PATH:$ GOBIN#
国内プロキシを設定
go env -w GOPROXY = https://goproxy.cn,direct

#安装cmake3
wget https://cmake.org/files/v3.16/cmake-3.16.0-rc2.tar.gz
tar xvzf cmake-3.16.0-rc2.tar.gz
cd cmake-3.16.0-rc2
#yum install -y gcc-c ++ make automake openssl-devel
./bootstrap
gmake
gmake install

cmake --version

#boringssl库gitclonehttps
://github.com/google/boringssl.git
cd boringssl
mkdir build
cd build 
cmake ../
make

###エラー報告
https://blog.csdn.net/aria_miazzy/article/details/107532236


src / event / ngx_event_quic_transport.c:関数 'ngx_quic_create_stream'内:
src / event / ngx_event_quic_transport.c:54:9:エラー:データ型の範囲が限られているため、比較は常にtrueです[-Werror = type-limits]
      :(( uint32_t)value)<= 16383?2 \
         ^
src / event / ngx_event_quic_transport.c:1299:15:注:マクロの展開中 'ngx_quic_varint_len'
         len = ngx_quic_varint_len(sf-> type);
               ^
cc1:すべての警告がエラーとして扱われる
make [1]:*** [objs / src / event /ngx_event_quic_transport.o]エラー1make
[1]:ディレクトリ `/ root / nginx-quic '
離れるmake:*** [ビルド]エラー2


####
cd nginx-quic \ objs
 
vi Makefile
 
find CFLAGS = -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I ../ Boringssl / include-Werrorパラメーターを削除します。


#Installカールhttps://sh.rustup.rs -sSf | SH

#下ダウンロードソース码適用適用
$ hg clone -b quic https://hg.nginx.org/nginx-quic
$ cd nginx-quic
$ ./auto/configure --with-debug --with-http_v3_module \
    --with- stream_quic_module --with-http_ssl_module --with-http_v2_module \
                       --with-cc-opt = "-I ../ Boringssl / include" \
                       --with-ld-opt = "-L ../ Boringssl / build / ssl \
                                      -L ../ Boringssl / build / crypto "


--with-http_v3_module-QUICとHTTP / 3を
        有効にします
        --with-http_quic_module-古いHTTPバージョンのQUICを有効にします--with-stream_quic_module--StreamでQUICを有効にします

make && make install

    #plicationnginx
server { listen 443 ssl http2;     #HTTP / 2リッスン用のTCPリスナー443http3再利用ポート;     #QUIC + HTTP / 3のUDPリスナーssl_protocolsTLSv1 TLSv1.1 TLSv1.2 TLSv1.3;     #QUICにはTLS1.3が必要ですssl_certificatessl / www.example.com.crt;     ssl_certificate_key ssl / www.example.com.key;     add_header Alt-Svc'quic = ":443"; h3-27 = ":443"; h3-25 = ":443"; h3-T050 = ":443"; h3-Q050 = ":443"; h3-Q049 = ":443"; h3-Q048 = ":443"; h3-Q046 = ":443"; h3-Q043 = ":443" '; #QUICが利用可能な     場所であることをアドバタイズします/ {                 #ブラウザがそれらをquicポートに         転送するために必要ですadd_header Alt-Svc ' $ http3 = ":443"; ma = 86400 ';     }


 



 

    



}

Firewall-cmd --zone = public --add-port = 443 / udp --permaent
Firewall-cmd --reload

#openssl自己署名証明書
https://www.cnblogs.com/hnxxcxg/p/7610582.html


秘密鍵の生成:openssl genrsa -des3 -out server.key 1024


#証明書署名要求openssl req -new -key server.key -out server.csr

注:国、地域、都市、組織、組織単位、一般名、メールアドレスを順番に入力する必要があります。その中で、一般名、あなたはあなた自身の名前またはドメイン名を書くことができます、

httpsをサポートする場合は、共通名がドメイン名と一致している必要があります。一致していない場合、ブラウザは次のように警告し
ます。
秘密鍵のパスワードを削除します。opensslrsa-in server.key -out server.key


自己署名証明書の生成openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

#配置フロー展開服务器需要
使用nginx-rtmp模块、需要重新编译
下取りnginx-rtmp模块 
git clone https://github.com/arut/nginx-rtmp-module.git

新命./auto/configure--with -http_v3_module --with-stream --with-http_quic_module --with-http_gunzip_module \
    --with-stream_quic_module --with-http_ssl_module --with-http_v2_module --add-module = / opt / nginx-rtmp-module --with -http_stub_status_module --with-pcre --with-http_dav_module --with-http_flv_module --with-http_mp4_module \
                       --with-cc-opt = "-I ../ Boringssl / include" \
                       --with-ld-opt = "-L ../ Boringssl / build / ssl \
                                      -L ../ Boringssl / build / crypto"
                                      
                                      
                                      
                                      
make && make install

#ストリーミング構成:
ここで自分でコンパイルできるとは限らないため、調査する必要があります。
https://github.com/evansun922/nginx-quicこのオープンソースプロジェクトを参照してください

    
参考記事:
https //www.nange.cn/quic-and-http3-for-nginx.html
https://blog.csdn.net/maimang1001/article/details/103603434
https://blog.csdn.net / aria_miazzy / article / details / 107532236

簡単なインストール方法:
https //www.mingilin.com/2020/11/06/centos/centos-nginx-quic/
https://copr.fedorainfracloud.org/coprs/ryoh/nginx-quic/

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

Centos 8:
sudo dnf install
epel -release sudo dnf copr enable ryoh / nginx-quic
sudo dnf install nginx-quic

增加適用:
443 http3reuseportをリッスンします。
#QUIC + HTTP / 3 ssl_protocolsTLSv1.3のUDPリスナー
#QUICにはTLS1.3が必要ですadd_headerAlt-Svc '$ http3 = ":443"; ma = 86400 '; #QUICが利用可能であることをアドバタイズします
add_header QUIC-Status $ quic;

おすすめ

転載: blog.csdn.net/qq_34777982/article/details/111318961