码迷,mamicode.com
首页 > 其他好文 > 详细

nginx重编译增加模块

时间:2018-03-14 22:06:38      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:nginx   nginx重新编译   nginx源码包   

cd ~/root/nginx

先下载模块源码包:

wget -O jemalloc-5.0.1.tar.bz2 http://125.88.182.172:5880/src/jemalloc-5.0.1.tar.bz2

wget -O pcre-$pcre_version.tar.gz http://125.88.182.172:5880/src/pcre-$pcre_version.tar.gz -T 5

wget -O /root/nginx/nginx-$nginxVersion.tar.gz http://125.88.182.172:5880/src/nginx-$nginxVersion.tar.gz -T20

wget -O openssl.tar.gz http://125.88.182.172:5880/src/openssl-1.0.2l.tar.gz -T 5

wget -O ngx_cache_purge.tar.gz http://125.88.182.172:5880/src/ngx_cache_purge-2.3.tar.gz

wget -O /root/nginx/conf/nginx.conf http://125.88.182.172:5880/conf/nginx.conf -T20

wget -O /root/nginx/html/index.html http://125.88.182.172:5880/error/index.html -T 5

wget -O nginx.init http://125.88.182.172:5880/init/nginx.init -T 5

wget -O waf.zip http://125.88.182.172:5880/install/waf/waf.zip

wget -c -O lua-5.3.4.tar.gz http://125.88.182.172:5880/install/src/lua-5.3.4.tar.gz -T 5

wget -c -O LuaJIT-2.0.4.tar.gz http://125.88.182.172:5880/install/src/LuaJIT-2.0.4.tar.gz -T 5

wget -c -O lua-nginx-module-master.zip http://125.88.182.172:5880/install/src/lua-nginx-module-master.zip -T 5

wget -c -O ngx_devel_kit-master.zip http://125.88.182.172:5880/install/src/ngx_devel_kit-master.zip -T 5

wget -c -O lua-nginx-module-master.zip http://125.88.182.172:5880/install/src/lua-nginx-module-master.zip -T 5

wget -c -O ngx_devel_kit-master.zip http://125.88.182.172:5880/install/src/ngx_devel_kit-master.zip -T 5

解压,需要编译的就编译,不需要的就不编译

tar -xvf jemalloc-5.0.1.tar.bz2

cd jemalloc-5.0.1

./configure

make && make install

ldconfig

cd ..

tar xzf pcre-8.40.tar.gz

yum install libtermcap-devel ncurses-devel libevent-devel readline-devel -y

tar xvf lua-5.3.4.tar.gz

cd lua-5.3.4

make linux

make install

cd ..

tar xvf LuaJIT-2.0.4.tar.gz

cd LuaJIT-2.0.4

make linux

make install

cd ..

export LUAJIT_LIB=/usr/local/lib

export LUAJIT_INC=/usr/local/include/luajit-2.0/

ln -sf /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib64/libluajit-5.1.so.2

echo "/usr/local/lib" >> /etc/ld.so.conf

ldconfig  #

下面接着编译nginx

cd  nginx-1.12.2

./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/tmp/nginx/client_body --http-proxy-temp-path=/var/nginx/proxy_temp_dir --http-fastcgi-temp-path=/tmp/nginx/fastcgi --pid-path=/var/run/nginx.pid --lock-path=/var/lock/subsys/nginx --add-module=/root/lnmp/ngx_devel_kit-master --add-module=/root/lnmp/lua-nginx-module-master --with-openssl=/root/lnmp/openssl-1.0.2l --with-http_v2_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-pcre=/root/lnmp/pcre-8.40 --with-http_realip_module --add-module=/root/lnmp/ngx_cache_purge-2.3 --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_mp4_module --with-ld-opt="-Wl,-E" --with-ld-opt="-ljemalloc"

只是增加模块:

make

[root@lnmp nginx-1.12.2]# cp -ar objs/nginx /usr/sbin/nginx

cp: overwrite ‘/usr/sbin/nginx’? y

cp: cannot create regular file ‘/usr/sbin/nginx’: Text file busy

[root@lnmp nginx-1.12.2]# cp /usr/sbin/nginx /usr/sbin/nginxbak

[root@lnmp nginx-1.12.2]# service nginx stop

Stopping nginx (via systemctl): [ OK ]

[root@lnmp nginx-1.12.2]# cp -ar objs/nginx /usr/sbin/nginx

cp: overwrite ‘/usr/sbin/nginx’? y

[root@lnmp nginx-1.12.2]# service nginx start

Starting nginx (via systemctl): [ OK ]
如果全新安装:

make && make install

使用里面的配置文件去替换默认配置文件即可。

nginx重编译增加模块

标签:nginx   nginx重新编译   nginx源码包   

原文地址:http://blog.51cto.com/m51cto/2086959

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!