nginx编译安装方式安装第三方模块
nginx编译安装方式安装第三方模块
安装 ngx_http_consistent_hash-master 模块
建议先把之前安装
make isntall
好的nginx全部删掉,不删也没问题,会在bin目录下生成nginx nginx.old
1. 查看之前安装的configure 命令
/usr/local/AppBuildedBySource/nginx/sbin/nginx -V
2. 下载添加模块 ngx_http_consistent_hash-master
cd /usr/local/AppBuildedBySource/src
wget https://github.com/replay/ngx_http_consistent_hash/archive/master.zip
unzip master.zip
3. 重新编译 加上新模块
#切换到nginx源码目录下
cd /usr/local/AppBuildedBySource/src/nginx-1.12.2
#重新编译 加上新模块
./configure --prefix=/usr/local/AppBuildedBySource/nginx --add-module=/usr/local/AppBuildedBySource/src/ngx_http_consistent_hash-master/
4. configure没问题的话,就make install
make && make install
#完成安装
安装 nginx 统计模块,便于观察nginx的状态
1. 查看之前安装的configure 命令
/usr/local/AppBuildedBySource/nginx/sbin/nginx -V
2. 重新编译 加上新模块
#切换到nginx源码目录下
cd /usr/local/AppBuildedBySource/src/nginx-1.12.2
#重新编译 加上新模块
./configure --prefix=/usr/local/AppBuildedBySource/nginx
--add-module=/usr/local/AppBuildedBySource/src/ngx_http_consistent_hash-master/
--with-http_stub_status_module
3. configure没问题的话,就make install
make && make install
#完成安装
4. 配置 nginx.conf
location /status{
stub_status on;
access_log off;
#allow 127.0.0.1:8101;
#deny all;
}
此时开启nginx服务,便可以在 localhost:8101/status 页面看到统计情况