首页 / NGINX / 03_Nginx添加新模块
03_Nginx添加新模块
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了03_Nginx添加新模块,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2873字,纯文字阅读大概需要5分钟。
内容图文
![03_Nginx添加新模块](/upload/InfoBanner/zyjiaocheng/1125/77285b7e0f6749acba2dd539037d1b49.jpg)
1 进入 nginx 安装目录,查看 nginx 版本及其编译参数:
[root@localhost nginx]# ./nginx -V nginx version: nginx/1.8.0 built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) built with OpenSSL 1.0.1c 10 May 2012 TLS SNI support enabled configure arguments: --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module --with-pcre=../pcre-8.37 --with-zlib=../zlib-1.2.8 --with-openssl=../openssl-1.0.1c --with-http_stub_status_module --user=nginx --group=nginx [root@localhost nginx]# |
2 进入 nginx 的源码目录:
[root@localhost src]# ls nginx-1.8.0 openssl-1.0.1c pcre-8.37 zlib-1.2.8 nginx-1.8.0.tar.gz openssl-1.0.1c.tar.gz pcre-8.37.tar.gz zlib-1.2.8.tar.gz [root@localhost src]# pwd /usr/local/src [root@localhost src]# cd nginx-1.8.0 [root@localhost nginx-1.8.0]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src [root@localhost nginx-1.8.0]# |
3 以下是重新编译的代码和模块:
./configure --sbin-path=/usr/local/nginx/nginx \ --conf-path=/usr/local/nginx/nginx.conf \ --pid-path=/usr/local/nginx/nginx.pid \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_auth_request_module \ --with-mail \ --with-mail_ssl_module \ --with-file-aio \ --with-http_spdy_module \ --with-ipv6 \ --with-pcre=../pcre-8.37 \ --with-zlib=../zlib-1.2.8 \ --with-openssl=../openssl-1.0.1c \ --user=nginx \ --group=nginx; |
截图如下:
详细参数请看官网: http://nginx.org/en/docs/configure.html
4 编译:
make (注意:千万不要 make install )
5 make 完成之后再当前目录下的 objs 目录下就多了个 nginx, 这个就是新版本的程序了
6 备份旧的 nginx 程序
[root@localhost objs]# cp /usr/local/nginx/nginx /usr/local/nginx/nginx.bak [root@localhost objs]# cd /usr/local/nginx/ [root@localhost nginx]# ls client_body_temp fastcgi_temp mime.types.default sbin uwsgi_temp conf html nginx scgi_params win-utf fastcgi.conf koi-utf nginx.bak scgi_params.default fastcgi.conf.default koi-win nginx.conf scgi_temp fastcgi_params logs nginx.conf.default uwsgi_params fastcgi_params.default mime.types proxy_temp uwsgi_params.default [root@localhost nginx]# |
6 把新的 nginx 程序覆盖旧的
[root@localhost nginx-1.8.0]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src [root@localhost nginx-1.8.0]# cp objs/nginx /usr/local/nginx/nginx cp :是否覆盖 "/usr/local/nginx/nginx" ? y [root@localhost nginx-1.8.0]# |
7 测试新的 nginx 程序是否正确
[root@localhost nginx-1.8.0]#/usr/local/nginx/nginx -t
8 平滑重启 nginx
/usr/local/nginx/nginx –s reload
9 查看 nginx 版本及其编译参数:
/usr/local/nginx/nginx –V
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/tototuzuoquan/article/details/47823161
内容总结
以上是互联网集市为您收集整理的03_Nginx添加新模块全部内容,希望文章能够帮你解决03_Nginx添加新模块所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。