Skip to content

Instantly share code, notes, and snippets.

@peerapach
Last active October 15, 2022 13:14
Show Gist options
  • Save peerapach/9e43640618a05636d67847defa4f0284 to your computer and use it in GitHub Desktop.
Save peerapach/9e43640618a05636d67847defa4f0284 to your computer and use it in GitHub Desktop.
build nginx to support the CONNECT method request (forward proxy)
apt-get update
apt-get install -y wget curl libpcre3 libpcre3-dev libssl-dev build-essential dh-make libpcre2-dev zlib1g-dev lsb-release quilt git
cd /tmp
git clone https://github.com/chobits/ngx_http_proxy_connect_module.git
wget http://nginx.org/packages/debian/pool/nginx/n/nginx/nginx_1.22.0.orig.tar.gz
tar xvzf nginx_1.22.0.orig.tar.gz
cd /tmp/nginx-1.22.0
patch -p1 < /tmp/ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_102101.patch
cd /tmp
tar cvzf nginx_1.22.0.orig.tar.gz nginx-1.22.0
cd /tmp/nginx-1.22.0
wget http://nginx.org/packages/debian/pool/nginx/n/nginx/nginx_1.22.0-1~bullseye.debian.tar.xz
tar xvf nginx_1.22.0-1~bullseye.debian.tar.xz
rm nginx_1.22.0-1~bullseye.debian.tar.xz
#### edit debian/rules
## add option to ./configure
## --add-module=/tmp/ngx_http_proxy_connect_module
####
dpkg-buildpackage
apt-get install -y mercurial libnet-dns-perl
export TEST_NGINX_BINARY=/usr/sbin/nginx
prove -v -I nginx-tests/lib /tmp/ngx_http_proxy_connect_module/t/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment