Nginx学习 (四) : source 编译 nginx 添加 Nginx Sticky Module

本文介绍了如何从源代码编译安装Nginx,并添加Nginx Sticky Module。首先,从指定地址下载Nginx 1.18.0稳定版源代码并解压。接着,下载Sticky Module的源代码,根据官方说明进行操作。在编译安装过程中,可能会遇到缺少PCRE库的问题,解决后重新运行配置命令。完成安装后,在配置文件中使用`sticky`替换`ip_hash`,并验证Nginx集群的正确性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

下载源代码

下载地址

http://hg.nginx.org/nginx/archive/release-1.18.0.tar.gz

这里还是用1.18.0 stable版本

下载到 /data/working/nginx_src

解压

tar zxvf release-1.18.0.tar.gz

Nginx Sticky Module

因为主要是要添加 nginx sticky module, 所以还要下载 nginx sticky module, 下载地址在这儿

https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip

说明在这儿 https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/src/master/

 

从源代码安装的基本流程

./configure ... 一堆配置项
make
make install

看看通过yum 安装的nginx的配置, 通过命令 

nginx -V

得到

--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_r
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值