nginquic : moved from scriptbox

This commit is contained in:
unknown 2022-06-11 20:09:10 +07:00
commit 4330c3c9ef
Signed by: minoplhy
GPG Key ID: 90667A59A9908AEC
6 changed files with 133 additions and 0 deletions

48
README.md Normal file
View File

@ -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
```

18
build.sh Normal file
View File

@ -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

54
configure.sh Normal file
View File

@ -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

6
modules.conf Normal file
View File

@ -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;

6
modules.sh Normal file
View File

@ -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

1
packages.sh Normal file
View File

@ -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