Debian 系 OS 下源代码编译 nginx 并启用 ngx_http_proxy_connect_module

前言

手握多个 Proxy Server,需要开启 HTTP Proxy。发现 nginx 并不支持 CONNECT 正向代理的语义,需要 ngx_http_proxy_connect_module 扩张 nginx 的机能。

因为总是需要手敲命令,故整理操作手册。

CLI

apt install gcc make openssl libssl-dev libpcre3 libpcre3-dev libgd-dev git
wget http://nginx.org/download/nginx-1.25.1.tar.gz
tar zxvf nginx-1.25.1.tar.gz
git clone https://github.com/chobits/ngx_http_proxy_connect_module.git
cd nginx-1.25.1
patch -p1 < ../ngx_http_proxy_connect_module/patch/proxy_connect_rewrite_102101.patch
./configure --with-pcre --with-http_stub_status_module --with-http_v2_module --with-http_v3_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-pcre-jit --add-module=../ngx_http_proxy_connect_module
make && make install
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[Unit]
Description=NGINX - High Performance Web Server
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPost=/bin/sleep 0.1
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> /usr/lib/systemd/system/nginx.service

systemctl daemon-reload
systemctl enable nginx
systemctl start nginx

参考

  1. GitHub: chobits/ngx_http_proxy_connect_module, https://github.com/chobits/ngx_http_proxy_connect_module
  2. nginx: download, https://nginx.org/en/download.html
CC-BY-NC-SA ー  無断転載はご遠慮下さい
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇