Giter Club home page Giter Club logo

nginx-quic's Introduction

Help us to improve the Nginx-Quic

Begin to Nginx-Quic

Why nginx-quic

The purpose of this project is to make nginx support quic and keep the original functions of nginx unchanged. this project requires nignx and chromium source code

At present, this project had only been tested under the Linux kernel and epoll network, which requires Linux kernel 4.18.20-1. El6. Elrepo. X86_64 and above, currently, nginx-quic only test on 1.14.2 and 1.16.0 version of nginx, and nginx-1.16.0 and above is recommended.

There is a compiled nginx-quic in bin,you can run it on centos, redhat, ubuntu, etc, the test nginx-quic's --prefix=/opt/nginx/.

中文版文档

Compile

The compilation step of nginx-quic is quite complicated, so I will try to explain it in detail. In addition, you can read some gn documents to learn it.

The compilation needs to be carried out under ubuntu 14, which can be compiled using virtual machine. please see the official website of chromium for Linux system requirements.

            python3 mk2gn.py </path/to/nginx> </path/to/chromium/src> <args>

             </path/to/nginx>:                      path of nginx.
             </path/to/chromium/src>:    path of chromium/src.
             < args>:                                          when configure nginx, the parameters required to configure.                 
  • cd /path/to/chromium/src, and run gn gen out/Release --args="is_component_build=false is_debug=false".
  • run ninja -C out/Release nginx.

Mark:

  • If you need to define macros or add some libraries, you can manually modify the chromium/src/net/BUILD.gn about the configuration of nginx.
                            executable("nginx") {
                                sources = [
                                    # the source file .c or .cc,  you don't usually modify it.
                                ]
                                include_dirs = [
                                    #add the directory dir to the list of directories to be searched for header files during preprocessing.
                                ]
                                lib_dirs = [
                                    #  add directory dir to the list of directories to be searched for libraries.
                                ]
                                libs = [
                                    # dynamic library: pthread or static library: /path/xxx.a
                                ]
                                cflags_c = [
                                    # compile option flags
                                    "-D_FORTIFY_SOURCE=2",
                                    "-DTCP_FASTOPEN=23",
                                    "-DNDK_SET_VAR",
                                ]
                            }
  • All of static libraries used by nginx, which should be compiled with the flag "-fPIC".
  • no use openssl, nginx-quic use boringssl of chromium.

nginx-quic Configuration

Example Configuration

      http {

          ...

          server {
               listen              443 quic reuseport  sndbuf=1048576 rcvbuf=1048576;
              
              quic_ssl_certificate                 ssl/tv.test.com.crt;
              quic_ssl_certificate_key       ssl/tv.test.com.pkcs8;



              ...
          }

Directives

Syntax:                listen   quic;
Default:               listen   *:80 | *:8000 quic;
Context:              server
Example:             listen       443 quic reuseport sndbuf=1048576 rcvbuf=1048576;
add flag "quic" of "listen" for using quic ,  when you use flag "quic", be sure to bring the flag "reuseport" and you can not used "ssl" or "http2" at the same time.


Syntax:        quic_ssl_certificate       /path/to/tv.test.com.crt;
Default:        — 
Context:      server
 ssl-certificate of quic. 


Syntax:               quic_ssl_certificate_key          /path/to/tv.test.com.pkcs8;
Default:              —
Context:             server
 ssl-certificate's key of quic. 


Syntax:            quic_bbr      on | off;
Default:           quic_bbr      off;
Context:          http,  server,  location
enable bbr of quic


Syntax:            quic_ietf_draft      on | off;
Default:           quic_ietf_draft      off;
Context:          http,  server,  location
use the IETF draft version.


Syntax:          quic_flush_interval     number;
Default:         quic_flush_interval     40;
Context:        http,  server,   location
the buffered of sendmmsg is refreshed every "number" milliseconds.


Syntax:          quic_idle_network_timeout     time;
Default:         quic_idle_network_timeout     10m;
Context:        http,  server,   location
Idle network timeout in seconds.

Copyright

  • SOHU-TV, Inc.

Author

nginx-quic's People

Contributors

evansun922 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

rai-mohammed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.