新安装和已安装nginx如何添加未编译安装模块/补丁
新安装和已安装nginx如何添加未编译安装模块/补丁
--http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10485&page=1&extra=#pid105098
新安装nginx如何添加未编译安装模块/补丁
之前发过一篇nginx如何添加未编译安装模块/补丁,那篇是安装nginx之后的,nginx已经在跑了,这一篇新安装nginx
http://www.apelearn.com/bbs/thread-10429-1-1.html
比如要安装 ngx_req_status模块 统计流量的
yum -y install patch unzip gcc pcre pcre-devel zlib zlib-devel openssl-devel openssl -y
mkdir /download;cd /download
wget http://nginx.org/download/nginx-1.4.6.tar.gz &&
wget https://github.com/zls0424/ngx_req_status/archive/master.zip -O ngx_req_status.zip
unzip /download/ngx_req_status.zip -d /usr/local/
tar -zxvf nginx-1.4.6.tar.gz
cd nginx-1.4.6
patch -p1 < /usr/local/ngx_req_status-master/write_filter.patch # patch命令进行打补丁
./configure --prefix=/usr/local/nginx --with-pcre \
--with-http_gzip_static_module --with-http_ssl_module \
--add-module=/usr/local/ngx_req_status-master && make -j2 && make install #启用2个cpu去编译,2个job,提高编译速度
rm -rf /usr/local/ngx_req_status-master
#启动nginx
/usr/local/nginx/sbin/nginx
#修改nginx.conf
http {
req_status_zone server_name $server_name 256k;
req_status_zone server_addr $server_addr 256k;
req_status_zone server_url $server_name$uri 256k;
req_status server_name server_addr server_url;
server {
listen 8080;
server_name test.com;
location /ttlsa-req-status {
allow 192.168.1.6;
allow 192.168.2.8;
deny all;
req_status_show on;
}
}
}
#reload一下/usr/local/nginx/sbin/nginx -s reload
#修改Windows的hosts文件
http://test.com:8080/ttlsa-req-status
#http://www.ttlsa.com/nginx/nginx-custom-header-to-return-information-module-ngx_headers_more/ 隐藏服务器的软件版本改为tomcat 7
sed -i 's/Server: nginx/Server: tomcat/' /download/nginx-1.4.6/src/http/ngx_http_header_filter_module.c
sed -i 's/1.4.6/7.0.52/' /download/nginx-1.4.6/src/core/nginx.h
sed -i 's/nginx\//tomcat/' /download/nginx-1.4.6/src/core/nginx.h
cat > /etc/ld.so.conf << EOF
> include ld.so.conf.d/*.conf
> /usr/local/lib #动态装入器将在/usr/local/lib 中查找共享库。
> EOF
ldconfig 更新ld.so.cache 文件,以读取最新的/etc/ld.so.conf
nginx如何添加未编译安装模块/补丁 [复制链接]
--http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=10429&page=1&extra=#pid103693
有这样一个增强的负载均衡模块,我们知道php添加扩展模块很容易,但是nginx呢?
下面是教程
“公平的”Nginx 负载均衡模块,增强了Nginx 提供的round-robin 负载均衡算法,可以跟踪后端服务器的负载来分发请求。
配置范例:
upstream mongrel {
fair;
server 127.0.0.1:5000;
server 127.0.0.1:5001;
server 127.0.0.1:5002;
}
原已经安装好的nginx,现在需要添加一个未被编译安装的模块:
nginx -V 可以查看原来编译时都带了哪些参数
--prefix=/usr/local/nginx --with-pcre --with-http_gzip_static_module --with-http_ssl_module --user=nginx --group=nginx --add-module=/usr/local/ngx_req_status-master
wget -O nginx-upstream-fair.zip https://github.com/gnosek/nginx-upstream-fair/archive/master.zip
步骤如下:
unzip /download/nginx-upstream-fair.zip -d /usr/local/
tar -zxvf nginx-1.4.6.tar.gz
cd nginx-1.4.6 #上面nginx -V 查出来的编译参数这里原样加上
./configure --prefix=/usr/local/nginx --with-pcre --with-http_gzip_static_module --with-http_ssl_module --user=nginx --group=nginx --add-module=/usr/local/ngx_req_status-master/ --add-module=/usr/local/nginx-upstream-fair-master/
#不要make install,否则就是覆盖安装,生成的nginx二进制文件放在当前目录的objs/下
make
替换nginx二进制文件:
cp /usr/local/nginx/sbin/nginx{,.bak}
/etc/init.d/nginx stop
cp /download/nginx-1.4.6/objs/nginx /usr/local/nginx/sbin/
rm -rf /usr/local/{nginx-upstream-fair-master,ngx_req_status-master}
f
新安装和已安装nginx如何添加未编译安装模块/补丁的更多相关文章
- 安装成功的nginx如何添加未编译安装模块
原已经安装好的nginx,现在需要添加一个未被编译安装的模块举例说明:安装第三方的ngx_cache_purge模块(用于清除指定URL的缓存)nginx的模块是需要重新编译nginx,而不是像apa ...
- 转:安装成功的nginx如何添加未编译安装模块
原已经安装好的nginx,现在需要添加一个未被编译安装的模块 举例说明:安装第三方的ngx_cache_purge模块(用于清除指定URL的缓存) nginx的模块是需要重新编译nginx,而不是像a ...
- 生产线上的Nginx如何添加未编译安装模块
正在生产线上跑着web前端是nginx+tomcat,现在有这样一个需求,需要对网站的单品页面和列表页设置缓存,不同的页面设置不同的缓存,但是由于开始没有安装ngx_cache_purge这个模块,现 ...
- 安装成功的nginx,如何添加未编译安装模块(非覆盖安装http_image_filter_module)
背景:1.做了图片上传小项目.2.图片上传,需要多图管理.3.图片上传,需要存储到Fastdfs.4.Fastdfs上的图片,和Nginx结合.5.Nginx从Fastdfs获得的图片,需要使用缩略图 ...
- 安装成功的nginx如何添加未编译模块?
在重启nginx后发生了错误,错误如下: nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /u ...
- nginx添加未编译安装模块
链接:http://taokey.blog.51cto.com/4633273/1318719
- 23、nginx动态添加nginx_upstream_check_module健康检查模块
nginx_upstream_check_module模块地址:https://github.com/yaoweibin/nginx_upstream_check_module 23.1.说明: 1. ...
- Nginx之解压编译安装-yellowcong
安装前准备 对于nginx编译安装需要先安装编译 的工具,然后再安装nginx依赖 yum -y install gcc gcc-c++ autoconf automake make yum -y i ...
- centos 7 下 nginx 1.10.3 编译安装的方法
安装所需环境 Nginx 是 C语言 开发,建议在 Linux 上运行,当然,也可以安装 Windows 版本,本篇则使用 CentOS 7 作为安装环境. 一. gcc 安装安装 nginx 需要先 ...
随机推荐
- apk 反编译工具的使用
在学习android 开发的时候,我们经常回尝试使用到别人的apk,希望能了解别人怎么编写的代码,于是想要一个能实现其反编译的软件,将软件反编译出来,查看其代码. 工具/原料 反编译软件dex2jar ...
- oracle客户端免安装配置、64位机器PL/SQL和VS自带的IIS连接问题
一.oracle客户端免安装配置 1.到oracle官网下载Oracle InstantClient, 把它解压缩到单独目录,例如C:\OracleClient,2. 添加环境变量 ORACLE_HO ...
- List 和 ObservableCollection的区别
在WPF中绑定一个集合的时候,比如:DataGrid.ItemsSource = new List<T>(); 这样的操作,会存在当数据行新增或者删除的时候不会得到及时的通知来刷新界面,而 ...
- 前端 ui 框架
Bootstrap:http://getbootstrap.com/css/ ant-design:https://ant.design/ weui:https://weui.io/ amazeui: ...
- docker中文、手册、教程
Docker资源 Docker官方英文资源: docker官网:http://www.docker.com Docker windows入门:https://docs.docker.com/windo ...
- windows下配置nutch注意的问题
1.为处理方便,直接在$nutch目录下创建一个名为url.txt文件,然后在文件里添加要搜索的网址,例如:http://www.sina.com.cn/,注意网址最后的"/"一定 ...
- mount: block device /dev/cdrom is write-protected, mounting read-only 解决方法
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/ mount: block device /dev/sr0 is write-protected, mo ...
- ExtJS6的中sencha cmd中自动创建案例项目代码分析
在之前的博文中,我们按照sencha cmd的指点,在自己win7虚拟机上创建了一个案例项目,相当于创建了一个固定格式的文档目录结构,然后里面自动创建了一系列js代码.这是使用sencha cmd自动 ...
- thinkphp5 Windows下用Composer引入官方GitHub扩展包
很多新手,比如说我,写代码就是在windows下,所以总会遇到很多不方便的地方,比如说GitHub上面的代码更新了,要是你在linux,只要几行命令就可以搞定更新了,在windows下面,你需要用到C ...
- java三方---->html解析jsoup的使用
jsoup 是一款 Java 的HTML 解析器,可直接解析某个URL地址.HTML文本内容.它提供了一套非常省力的API,可通过DOM,CSS以及类似于JQuery的操作方法来取出和操作数据.今天我 ...