From 4330c3c9ef7b929a020ecd19a280c27f71760d9d Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 Jun 2022 20:09:10 +0700 Subject: [PATCH] nginquic : moved from scriptbox --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 18 ++++++++++++++++++ configure.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ modules.conf | 6 ++++++ modules.sh | 6 ++++++ packages.sh | 1 + 6 files changed, 133 insertions(+) create mode 100644 README.md create mode 100644 build.sh create mode 100644 configure.sh create mode 100644 modules.conf create mode 100644 modules.sh create mode 100644 packages.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab91edd --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +## Status : Succeeded `(As of `[ace356d5e99af0716b3974611b1e55ef115eddac](https://github.com/minoplhy/scriptbox/commit/ace356d5e99af0716b3974611b1e55ef115eddac)` at Mar 9 2022)` +# Note to Self : +This Script is using to build nginx with quic and some modules i'm currently using . + +- **Please Purge existed Nginx before build** +- **Please don't named any folder in your Home Folder to 'nginquic', because this folder will be removed first once script is run** + +OS : Debian + +```shell +curl https://raw.githubusercontent.com/minoplhy/nginquic/main/build.sh | sudo bash +``` + +systemd Template: +`Location : /lib/systemd/system/nginx.service` + +``` +# Stop dance for nginx +# ======================= +# +# ExecStop sends SIGSTOP (graceful stop) to the nginx process. +# If, after 5s (--retry QUIT/5) nginx is still running, systemd takes control +# and sends SIGTERM (fast shutdown) to the main process. +# After another 5s (TimeoutStopSec=5), and if nginx is alive, systemd sends +# SIGKILL to all the remaining processes in the process group (KillMode=mixed). +# +# nginx signals reference doc: +# http://nginx.org/en/docs/control.html +# +[Unit] +Description=A high performance web server and a reverse proxy server +Documentation=man:nginx(8) +After=network.target nss-lookup.target + +[Service] +Type=forking +PIDFile=/run/nginx.pid +ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;' +ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;' +ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload +ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid +TimeoutStopSec=5 +KillMode=mixed + +[Install] +WantedBy=multi-user.target + +``` diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..2bfcd47 --- /dev/null +++ b/build.sh @@ -0,0 +1,18 @@ +cd ~/ +rm -rf nginquic +curl -sSL https://raw.githubusercontent.com/minoplhy/nginquic/main/packages.sh | bash +mkdir nginquic && cd nginquic +hg clone -b quic https://hg.nginx.org/nginx-quic +git clone https://github.com/google/boringssl +cd boringssl +mkdir build && cd build && cmake .. && make +cd .. && cd .. +cd nginx-quic +mkdir mosc && cd mosc && curl -sSL https://raw.githubusercontent.com/minoplhy/nginquic/main/modules.sh | bash && cd .. +curl -sSL https://raw.githubusercontent.com/minoplhy/nginquic/main/configure.sh | bash && make +mkdir /lib/nginx/ && mkdir /lib/nginx/modules +cd objs && cp *.so /lib/nginx/modules +rm /usr/sbin/nginx +cp nginx /usr/sbin/nginx +curl -sSL https://raw.githubusercontent.com/minoplhy/nginquic/main/modules.conf > modules.conf +cp modules.conf /etc/nginx/modules-enabled \ No newline at end of file diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000..fac63dc --- /dev/null +++ b/configure.sh @@ -0,0 +1,54 @@ +./auto/configure \ +--with-cc-opt="-I../boringssl/include" \ +--with-ld-opt="-L../boringssl/build/ssl \ +-L../boringssl/build/crypto" \ +--prefix=/usr/share/nginx \ +--conf-path=/etc/nginx/nginx.conf \ +--http-log-path=/var/log/nginx/access.log \ +--error-log-path=/var/log/nginx/error.log \ +--lock-path=/var/lock/nginx.lock \ +--pid-path=/run/nginx.pid \ +--modules-path=/usr/lib/nginx/modules \ +--http-client-body-temp-path=/var/lib/nginx/body \ +--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ +--http-proxy-temp-path=/var/lib/nginx/proxy \ +--http-scgi-temp-path=/var/lib/nginx/scgi \ +--http-uwsgi-temp-path=/var/lib/nginx/uwsgi \ +--with-compat \ +--with-debug \ +--with-pcre-jit \ +--with-http_ssl_module \ +--with-http_stub_status_module \ +--with-http_realip_module \ +--with-http_auth_request_module \ +--with-http_v2_module \ +--with-http_dav_module \ +--with-http_slice_module \ +--with-threads \ +--with-http_addition_module \ +--with-http_flv_module \ +--with-http_gunzip_module \ +--with-http_gzip_static_module \ +--with-http_image_filter_module=dynamic \ +--with-http_mp4_module \ +--with-http_perl_module=dynamic \ +--with-http_random_index_module \ +--with-http_secure_link_module \ +--with-http_sub_module \ +--with-http_xslt_module=dynamic \ +--with-mail=dynamic \ +--with-mail_ssl_module \ +--with-stream \ +--with-stream_realip_module \ +--with-stream_ssl_module \ +--with-stream_ssl_preread_module \ +--add-dynamic-module=mosc/headers-more-nginx-module \ +--add-dynamic-module=mosc/ngx_http_auth_pam_module \ +--add-dynamic-module=mosc/ngx_cache_purge \ +--add-dynamic-module=mosc/nginx-dav-ext-module \ +--add-dynamic-module=mosc/echo-nginx-module \ +--add-dynamic-module=mosc/nginx-upload-progress-module \ +--with-http_v3_module \ +--with-stream_quic_module \ +--with-http_geoip_module \ +--with-stream_geoip_module \ No newline at end of file diff --git a/modules.conf b/modules.conf new file mode 100644 index 0000000..0db1454 --- /dev/null +++ b/modules.conf @@ -0,0 +1,6 @@ +load_module /lib/nginx/modules/ngx_http_auth_pam_module.so; +load_module /lib/nginx/modules/ngx_http_cache_purge_module.so; +load_module /lib/nginx/modules/ngx_http_dav_ext_module.so; +load_module /lib/nginx/modules/ngx_http_echo_module.so; +load_module /lib/nginx/modules/ngx_http_headers_more_filter_module.so; +load_module /lib/nginx/modules/ngx_http_uploadprogress_module.so; diff --git a/modules.sh b/modules.sh new file mode 100644 index 0000000..e8151fd --- /dev/null +++ b/modules.sh @@ -0,0 +1,6 @@ +git clone https://github.com/openresty/headers-more-nginx-module +git clone https://github.com/sto/ngx_http_auth_pam_module +git clone https://github.com/arut/nginx-dav-ext-module/ +git clone https://github.com/openresty/echo-nginx-module +git clone https://github.com/masterzen/nginx-upload-progress-module +git clone https://github.com/nginx-modules/ngx_cache_purge \ No newline at end of file diff --git a/packages.sh b/packages.sh new file mode 100644 index 0000000..c7b389f --- /dev/null +++ b/packages.sh @@ -0,0 +1 @@ +sudo apt-get install mercurial golang libunwind-dev libpcre3 libpcre3-dev zlib1g-dev cmake make libxslt1-dev libgd-dev libssl-dev libperl-dev libpam0g-dev libgeoip-dev git -y