03_Nginx加入新模块
Posted yxysuanfa
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了03_Nginx加入新模块相关的知识,希望对你有一定的参考价值。
1 进入nginx安装文件夹,查看nginx版本号及其编译參数:
[[email protected] 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 [[email protected] nginx]# |
2 进入nginx的源代码文件夹:
[[email protected] 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 [[email protected] src]# pwd /usr/local/src [[email protected] src]# cd nginx-1.8.0 [[email protected] nginx-1.8.0]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src [[email protected] 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程序
[[email protected] objs]# cp /usr/local/nginx/nginx /usr/local/nginx/nginx.bak [[email protected] objs]# cd /usr/local/nginx/ [[email protected] 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 [[email protected] nginx]# |
6 把新的nginx程序覆盖旧的
[[email protected] nginx-1.8.0]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE Makefile man objs README src [[email protected] nginx-1.8.0]# cp objs/nginx /usr/local/nginx/nginx cp:是否覆盖"/usr/local/nginx/nginx"? y [[email protected] nginx-1.8.0]# |
7 測试新的nginx程序是否正确
[[email protected] nginx-1.8.0]#/usr/local/nginx/nginx -t
8 平滑重新启动nginx
/usr/local/nginx/nginx –s reload
9 查看nginx版本号及其编译參数:
/usr/local/nginx/nginx –V
以上是关于03_Nginx加入新模块的主要内容,如果未能解决你的问题,请参考以下文章
nginx/wsgi/Virtualenv/pip/yolk/django 配置添加新模块
Openresty之resty.limit.conn模块介绍